fix: retry divider centering until the feed renders on cold start - #45
Merged
Conversation
…start On a notification cold start the boundary divider could fail to center, leaving the user stranded at the top with the "New posts above" seam off-screen below. Subscriptions load asynchronously (IndexedDB), so when boundaryNonce bumped the feed often wasn't rendered yet — the one-shot centering effect queried [data-divider], found nothing, and gave up. By the time subscriptions arrived and the feed (and divider) mounted, the nonce never changed again, so centering never retried. Arm a pending-center flag on the nonce bump and run it only once the [data-divider] element exists; the divider's own ref callback re-invokes it the moment it mounts, so a late-rendering feed still lands centered. The flag is consumed on success so it fires exactly once. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VxfMbEXhsWRjjXEr5GMcF9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On an Android notification cold start, the boundary divider could fail to center, leaving the user stranded at the top with the "New posts above" seam off-screen below (reported in the morning with 10+ overnight posts).
Root cause
Subscriptions load asynchronously from IndexedDB. When
boundaryNoncebumped, the feed (and thus the[data-divider]element) often was not rendered yet, becauseSubscribedPageearly-returns "No subscriptions yet" whilehandlesis empty. The one-shot centering effect queried[data-divider], found nothing, and gave up. By the time subscriptions arrived and the feed mounted, the nonce never changed again, so centering never retried → stayed at top.Fix
Arm a pending-center flag on the nonce bump and run it only once
[data-divider]exists. The divider's ownonDividerRefcallback re-invokes the check the moment it mounts, so a late-rendering feed still lands centered. The flag is consumed on success so it fires exactly once. Covers both the cold-start race (ref callback) and the warm/flush case (effect).Verified: tsc clean, web build passes.
🤖 Generated with Claude Code