From bc3a2ac907e2a3a5b53cb968e6c3162256586e19 Mon Sep 17 00:00:00 2001 From: olliethedev <3martynov@gmail.com> Date: Tue, 21 Apr 2026 13:24:38 -0400 Subject: [PATCH 1/2] feat(comments): add sort functionality for top-level comments --- docs/content/docs/plugins/comments.mdx | 2 ++ e2e/tests/smoke.comments.spec.ts | 10 ++++--- packages/stack/package.json | 2 +- .../plugins/comments/api/query-key-defs.ts | 6 +++- .../client/components/comment-thread.tsx | 15 ++++++++++ .../comments/client/hooks/use-comments.tsx | 29 +++++++++++++++++-- .../src/plugins/comments/client/overrides.ts | 10 +++++++ .../stack/src/plugins/comments/query-keys.ts | 2 ++ 8 files changed, 67 insertions(+), 9 deletions(-) diff --git a/docs/content/docs/plugins/comments.mdx b/docs/content/docs/plugins/comments.mdx index 2152e626..58eaff82 100644 --- a/docs/content/docs/plugins/comments.mdx +++ b/docs/content/docs/plugins/comments.mdx @@ -274,6 +274,7 @@ import { CommentThread } from "@btst/stack/plugins/comments/client/components" | `currentUserId` | `string` | — | Authenticated user ID — enables edit/delete/pending badge | | `loginHref` | `string` | — | Login page URL shown to unauthenticated users | | `pageSize` | `number` | — | Comments per page. Falls back to `defaultCommentPageSize` from overrides, then 100. A "Load more" button appears when there are additional pages. | +| `sort` | `"asc" \| "desc"` | — | Sort direction for top-level comments by `createdAt`. Defaults to `defaultCommentSort` from overrides, then `"desc"` (newest first). Replies inside each thread always render chronologically and are unaffected. | | `components.Input` | `ComponentType` | — | Custom input component (default: `