Default to oldest

merged…
osebo51d ago

For the thread reply chain, you know what to do

2 repliesoldestnewest
Osebotfable-5-151d ago

Thread replies currently default to newest-first (app/threads/[id]/page.tsx treats anything but ?order=oldest as newest). Flipping the default so the reply chain reads top-to-bottom chronologically (oldest first), with ?order=newest as the opt-in; order toggle links stay. Checking for other places that depend on the default (post links, live updates).

Osebotfable-5-151d agothreadide@08ccc68

Thread replies now default to oldest-first, so the reply chain reads top-to-bottom in the order it happened under the pinned opening post.

What changed

  • app/threads/[id]/page.tsx: ?order parsing flipped — anything other than ?order=newest renders oldest-first (previously anything other than ?order=oldest was newest-first).
  • components/order-toggle.tsx: links reordered so the default ("oldest") is listed first; ?order=newest is the opt-in. No CSS changes needed (.order-toggle a.on still marks the active one).

These were the only two places that referenced the param, so no other links or the live/SSE updates are affected. tsc --noEmit is clean. Pushed to thread/4946381b (no PR opened — say the word if you want one).

Diff · 2 files
diff --git a/threadide/app/threads/[id]/page.tsx b/threadide/app/threads/[id]/page.tsx
--- a/threadide/app/threads/[id]/page.tsx
+++ b/threadide/app/threads/[id]/page.tsx
@@ -33,7 +33,8 @@ export default async function ThreadPage({
   searchParams: Promise<{ order?: string }>;
 }) {
   const { id } = await params;
-  const order = (await searchParams).order === "oldest" ? "oldest" : "newest";
+  // Replies read top-to-bottom in the order they happened; ?order=newest is the opt-in flip.
+  const order = (await searchParams).order === "newest" ? "newest" : "oldest";
   const user = await currentUser();
diff --git a/threadide/components/order-toggle.tsx b/threadide/components/order-toggle.tsx
--- a/threadide/components/order-toggle.tsx
+++ b/threadide/components/order-toggle.tsx
@@ -1,14 +1,15 @@
 import Link from "next/link";
 
+/** Reply order switch. Oldest-first is the default (see app/threads/[id]/page.tsx). */
 export function OrderToggle({ order }: { order: "newest" | "oldest" }) {
   return (
     <span className="order-toggle">
-      <Link href="?order=newest" className={order === "newest" ? "on" : ""} scroll={false}>
-        newest
-      </Link>
       <Link href="?order=oldest" className={order === "oldest" ? "on" : ""} scroll={false}>
         oldest
       </Link>
+      <Link href="?order=newest" className={order === "newest" ? "on" : ""} scroll={false}>
+        newest
+      </Link>
     </span>
   );
 }