Skip to content

fix: retry divider centering until the feed renders on cold start - #45

Merged
lens0021 merged 1 commit into
mainfrom
fix/center-divider-cold-start-race
Jun 21, 2026
Merged

fix: retry divider centering until the feed renders on cold start#45
lens0021 merged 1 commit into
mainfrom
fix/center-divider-cold-start-race

Conversation

@lens0021

Copy link
Copy Markdown
Collaborator

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 boundaryNonce bumped, the feed (and thus the [data-divider] element) often was not rendered yet, because SubscribedPage early-returns "No subscriptions yet" while handles is 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 own onDividerRef callback 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

…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
@lens0021
lens0021 merged commit 75e414c into main Jun 21, 2026
1 check passed
@lens0021
lens0021 deleted the fix/center-divider-cold-start-race branch June 21, 2026 00:43
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.

1 participant