Reddit Multi Column: fix residual iOS stacked-column flash on post tap (v0.3.24)#20
Merged
Merged
Conversation
…ost-tap (v0.3.24) The 0.3.23 fix recognised the lingering previous feed by reference equality (found === priorFeed). Reddit's router navigates to a post with a pushState immediately followed by a replaceState to the canonical permalink — two path changes in one task. onNavigate nulls `parent` on the first, so the second captures priorFeed = null; the re-search then re-finds the still-visible gridded feed, the equality check fails, and the grid stands down WHILE VISIBLE, flashing the feed as a single stacked column. The slow iOS/iPadOS SPA swap leaves that un-gridded frame on screen; desktop swaps too fast to show it. Fix: mark every feed we grid with a durable __rmcGridded flag and decide suppression from that flag (read before standDown) instead of the fragile priorFeed reference. A gridded node re-found on a post-detail page is, by definition, the previous feed lingering through the swap, so it stays hidden regardless of how priorFeed was lost. priorFeed is kept as a secondary signal. Verified in a headless-browser harness modelling the slow swap: single-nav was already clean; push→replace double-nav (and triple-nav, slow-swap, and the post→back round-trip) flashed all cards at full opacity before this change and flash zero frames after, with back-navigation correctly re-gridding and revealing the feed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLuykcA557aWJq7fCrwToV
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.
Problem
On iPad/iOS Safari, tapping a post sometimes un-grids the multi-column feed into a single stacked column for a moment before the post page renders — the symptom v0.3.23 set out to fix, still leaking through intermittently.
Root cause
v0.3.23 keeps the lingering previous feed hidden, but recognises it by reference equality (
found === priorFeed). Reddit's router navigates to a post with apushStateimmediately followed by areplaceStateto the canonical permalink (the URL with the title slug) — two path changes in the same task.onNavigatenullsparenton the first change, so the second one capturespriorFeed = null:The re-search then re-finds the still-visible gridded feed,
found === priorFeedisfound === null→ false, so it takes therevealFeedbranch andstandDown()un-grids the feed while it is still visible = the stacked flash. Desktop swaps too fast to ever show the un-gridded frame; the slow iOS/iPadOS SPA swap leaves it on screen. This is why it was intermittent.Fix
Mark every feed we grid with a durable
__rmcGriddedflag and decide suppression from that flag (read beforestandDown()) instead of the fragilepriorFeedreference. A gridded node re-found on a post-detail page is, by definition, the previous feed lingering through the swap, so it stays hidden no matter howpriorFeedwas lost.priorFeedis kept only as a secondary signal.The behavioural change is 4 lines; the rest is the changelog/comment block and a version bump to 0.3.24.
The change only alters the
isPostDetail()-true branch, so portrait/too-narrow rotation, profile, and search stand-downs are byte-for-byte the priorrevealFeedbehavior and cannot regress.Verification
Built a headless-browser harness (Playwright + Chromium) that serves a mock Reddit SPA, injects the real userscript, grids the feed, then simulates the post tap with the slow iOS-style content swap. A
MutationObserver(fires after each synchronous script batch — the state about to paint) plus a rAF sampler record any frame where the original feed is effectively visible and un-gridded.op 1.00, 8/8)Back-navigation correctly re-grids and reveals the feed; the genuine profile-comments mixed feed is unaffected; no page errors.
🤖 Generated with Claude Code
Generated by Claude Code