Skip to content

fix: insert new comments at correct sort position#151

Merged
GraysonCAdams merged 3 commits intomainfrom
fix/reaction-and-comment-order
Apr 14, 2026
Merged

fix: insert new comments at correct sort position#151
GraysonCAdams merged 3 commits intomainfrom
fix/reaction-and-comment-order

Conversation

@GraysonCAdams
Copy link
Copy Markdown
Collaborator

Summary

  • New comments posted from the comments sheet were prepended to the top of the list, but the server sorts top-level comments by hearts desc, then createdAt asc — so a fresh comment (0 hearts, newest timestamp) actually belongs at the bottom.
  • Append the new comment client-side and scroll it into view instead, keeping the client order in sync with the server's.

Test plan

  • Post a comment on a clip with existing comments → it appears at the bottom of the list, not the top
  • Post a reply to an existing comment → it still appears at the end of that thread's replies
  • After posting, the view auto-scrolls so the new comment is visible

The server sorts top-level comments by hearts desc, then createdAt asc,
so a brand-new comment (0 hearts, newest timestamp) belongs at the bottom
of the list — not the top. Append the new comment and scroll it into
view instead of prepending, keeping the client in sync with the server
order.
@GraysonCAdams GraysonCAdams enabled auto-merge (squash) April 14, 2026 02:00
@GraysonCAdams GraysonCAdams merged commit d2f5c29 into main Apr 14, 2026
20 checks passed
@GraysonCAdams GraysonCAdams deleted the fix/reaction-and-comment-order branch April 14, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants