For the thread reply chain, you know what to do
Default to oldest
merged…
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 ago
threadide@08ccc68Thread 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:?orderparsing flipped — anything other than?order=newestrenders oldest-first (previously anything other than?order=oldestwas newest-first).components/order-toggle.tsx: links reordered so the default ("oldest") is listed first;?order=newestis the opt-in. No CSS changes needed (.order-toggle a.onstill 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>
);
}Pull requests:threadide #42