Skip to content

fix: show flagged replies on a comment's page, and two smaller fixes - #321

Merged
therealsama merged 3 commits into
mainfrom
fix/comment-view-flagged-replies-and-parent-link
Nov 3, 2026
Merged

therealsama merged 3 commits into
mainfrom
fix/comment-view-flagged-replies-and-parent-link

Conversation

@therealsama

@therealsama therealsama commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes three bugs.

Bug fixes

  • A comment's own page left out flagged and deleted replies, and every reply under them. Both the desktop page and the phone's full-screen comment built replies from Algolia's item tree, which drops those comments with their whole subtree. The story thread already brings them back (fix: keep replies to flagged comments, page domain feeds fully, and four smaller fixes #318), so the same comment showed fewer replies on its own page. On story 50319510, comment 50320482 showed 23 replies in the thread and 8 on its page: a flagged reply and its 14 replies were missing. The page still shows the item tree's replies first. It then reads the story's comments from search and the missing parents from Firebase, the way the thread does, through a new fetchCommentReplies(), and swaps in the fuller tree when it has more comments. Flagged replies show [flagged] and deleted ones [deleted], with their replies under them. If that read fails, the item tree's replies stay. Comments on the same story share one read for five minutes, so the swipe viewer's neighbouring panels (up to five load at once) don't each search the whole story. That page now shows all 23, on desktop and on a phone. This closes the comment-view limitation listed in fix: keep replies to flagged comments, page domain feeds fully, and four smaller fixes #318.

    When the item tree has no replies for a comment, the page first reads the comment and its replies from Firebase. It searches the story only if one of those replies has replies of its own or is live. Otherwise it says "No replies yet." without searching: most such comments have no replies at all, and the rest mostly have only flagged or deleted replies with nothing under them, which the page doesn't show. While a search that may add replies is running, the replies section keeps its skeleton instead of saying "No replies yet." Before that, comment 50322186 said "No replies yet." for about two seconds and then showed its flagged reply. On four front-page stories (1,936 comments), 21 comments had no replies in the item tree but some in Firebase. The check searched for the 5 that gain replies and skipped the 16 that don't.

  • On a phone, the "parent" link briefly switched the URL back to the reply, and Back from the parent could land on the wrong comment. The swipe comment viewer's URL-sync effect ran in the same pass as the effect that handles an outside navigation, while its state still held the previous comment's siblings, and so it navigated to one of those.

    • Tapping "parent" pushed the parent's URL, replaced it with the reply's about 16ms later, then replaced it with the parent's again once the parent's siblings loaded, around 600ms later. A reload or share in that window used the reply's URL.
    • Pressing Back from the parent replaced the reply's history entry with the parent's URL, then replaced it again once the reply's siblings loaded. In the browser, Back from the parent of 50322990 landed on 50321529, one of 50322990's siblings, and the history entry for 50322990 was gone.

    The sync now also checks the scroll-init ref, which the navigation effect resets just before it runs. In the browser the tap now makes one pushState, Back makes no history writes, and both land on the right comment. The existing e2e test only checked the final URL after the tap, which was always right.

  • /from/ with no domain said "This item doesn't exist or may have been removed." under "No domain specified", because only the title overrode StateView's not-found defaults. It now says "Pick a story's site to see more submissions from it."

Known limitations

  • Threads over 1,000 comments still leave out flagged and deleted replies on a comment's page. Search can't return the whole thread, so the page skips the read after the first page and keeps the item tree's replies. The thread has the same gap at that size (see fix: keep replies to flagged comments, page domain feeds fully, and four smaller fixes #318).
  • The added replies arrive after the rest. On a slow connection that took a few seconds for a 600-comment story, since search pages load one after another. A comment whose replies all come from that read shows the skeleton until then.
  • Opening a comment from its story thread searches the story's comments again, up to five pages, though the thread already has them. Reusing the thread's copy is left for a follow-up. So is reading a comment's few hidden replies from Firebase instead of searching the whole story when the item tree has none.
  • The shared read is a story snapshot up to five minutes old. Live replies always come fresh from the item tree. Only the flagged and deleted ones come from the snapshot.
  • A flagged comment whose replies are all flagged still has no story id, so it gets no added replies.
  • If the connection drops after a comment loads but before Firebase answers the reply check, a comment with no item-tree replies keeps its skeleton until Firebase reconnects. The thread title's placeholder already waits the same way.

A comment's page built its replies from Algolia's item tree, which leaves
out flagged and deleted comments along with every reply under them. The
story thread already brings those back, so the same comment showed fewer
replies on its own page. On story 50319510, comment 50320482 showed 23
replies in the thread and 8 on its page, desktop and phone alike: a
flagged reply and its 14 replies were missing.

The page still shows the item tree's replies first. It then reads the
story's comments from search and the missing parents from Firebase, as
the thread does, and swaps in the fuller tree when it has more comments.
A flagged reply shows [flagged] with its replies, and a deleted one shows
[deleted]. If that read fails, the item tree's replies stay.

When the item tree has no replies, the page first reads the comment and
its replies from Firebase, and searches only if one of those has replies
of its own or is live. Most such comments have no replies at all, and the
rest mostly have only flagged or deleted replies with nothing under them,
which the page doesn't show. While a search that may add replies runs,
the replies section keeps its skeleton instead of saying "No replies yet."

Comments on the same story share one read for five minutes, so the swipe
viewer's neighbouring panels don't each search the whole story. Threads
bigger than search returns (1,000 comments) skip it after the first page
and keep the item tree's replies.
…ads to

In the swipe comment viewer, tapping "parent" pushed the parent's URL,
then about 16ms later replaced it with the reply's URL, then replaced it
with the parent's again once the parent's siblings loaded, around 600ms
later. A reload or share in that window used the reply's URL. Back from
the parent replaced the reply's history entry with the parent's URL, and
could land on one of the reply's siblings instead of the reply.

The URL-sync effect ran in the same pass as the effect that handles an
outside navigation, while its state still held the previous comment's
siblings. It now also checks the scroll-init ref, which the navigation
effect resets before it runs.
/from/ with no domain showed "No domain specified" over the default
not-found text, "This item doesn't exist or may have been removed."
@therealsama
therealsama force-pushed the fix/comment-view-flagged-replies-and-parent-link branch from 027be8a to e489542 Compare November 3, 2026 15:43
@therealsama
therealsama enabled auto-merge November 3, 2026 23:32
@therealsama
therealsama merged commit 084cea3 into main Nov 3, 2026
4 checks passed
@therealsama
therealsama deleted the fix/comment-view-flagged-replies-and-parent-link branch November 3, 2026 23:34
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