Skip to content

Reddit Multi Column: fix residual iOS stacked-column flash on post tap (v0.3.24)#20

Merged
heyflorin merged 1 commit into
mainfrom
claude/reddit-multi-column-ios-vxnwa1
Jun 27, 2026
Merged

Reddit Multi Column: fix residual iOS stacked-column flash on post tap (v0.3.24)#20
heyflorin merged 1 commit into
mainfrom
claude/reddit-multi-column-ios-vxnwa1

Conversation

@heyflorin

Copy link
Copy Markdown
Owner

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 a pushState immediately followed by a replaceState to the canonical permalink (the URL with the title slug) — two path changes in the same task. onNavigate nulls parent on the first change, so the second one captures priorFeed = null:

priorFeed = (parent && parent.isConnected) ? parent : null; // parent already null → null

The re-search then re-finds the still-visible gridded feed, found === priorFeed is found === nullfalse, so it takes the revealFeed branch and standDown() 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 __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 no matter how priorFeed was lost. priorFeed is 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.

// makeLayout (grid path)
parent.__rmcGridded = true;

// engageFeed (stand-down branch)
const wasGridded = !!found.__rmcGridded || found === priorFeed;
standDown();
if (wasGridded && isPostDetail()) { suppressed = true; hideFeed(); }
else { suppressed = false; revealFeed(); }

The change only alters the isPostDetail()-true branch, so portrait/too-narrow rotation, profile, and search stand-downs are byte-for-byte the prior revealFeed behavior 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.

Scenario Before (0.3.23) After (0.3.24)
single-nav (control) ok ok
single-nav + churn ok ok
double-nav (push→replace) FLASH 8/8 @ op 0.98 ok
double-nav + churn FLASH 8/8 ok
double-nav + slow swap 250ms FLASH 8/8 ok
triple-nav (push + 2× replace) FLASH 8/8 ok
profile-comments mixed feed ok ok
double-nav then BACK FLASH 8/8 ok — re-grids & reveals (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

…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
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