Fix hero carousel freezing while Home is covered/backgrounded - #88
Merged
Conversation
HeroRailView's auto-advance timer isn't gated on the view's on-screen visibility, so it keeps ticking (and writing to the scrollPosition state var the dot indicator reads) even while Home sits underneath a pushed detail screen or the Player's fullScreenCover. The real backing UIScrollView can't actually move itself while off-screen/detached, so it silently stays wherever it last was — state and the visible content quietly desync, with nothing to reconcile them once Home becomes visible again. Symptom (live-reproduced): the dot indicator kept advancing every ~5s with the Player closed and Home back on screen, while the hero content itself stayed frozen on whatever item was showing when the Player was opened — until a real touch-driven swipe forced the scroll view to resync, after which auto-advance resumed normally on its own. Fix: wrap the paging ScrollView in a ScrollViewReader and force a real, animation-free proxy.scrollTo(_:anchor:) to the current scrollPosition on onAppear — the same nudge a manual swipe was giving it for free, now applied automatically the instant Home becomes visible again (covers both returning from a detail push and from the Player's fullScreenCover). Verified on the simulator: reproduced the original bug live, confirmed a manual swipe "unstuck" it, then rebuilt with the fix and reproduced the same cover/return sequence (push into a detail screen, wait through a couple of auto-advance ticks, pop back) — the hero content now matches the dot immediately with no manual nudge needed, and auto-advance keeps running smoothly afterward. Full test suite (469 tests) still passes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
Fixes a bug (found while manually testing, unrelated to the trickplay work in #87) where Home's hero carousel dot indicator keeps advancing on its own, but the visible backdrop/logo content freezes on whatever item was showing when the carousel was last covered — e.g. after opening and closing the Player, or pushing into a detail screen and popping back.
Root cause
HeroRailView's auto-advancetickTimerisn't gated on the view's on-screen visibility. Because a pushed detail screen (and the Player, presented via.fullScreenCoverfrom there) sits above Home in the sameNavigationStack, Home stays mounted underneath rather than being torn down — so the timer keeps ticking and writing to thescrollPositionstate var (which the dot indicator is a pure function of) the whole time it's covered. The real backingUIScrollViewcan't actually move itself while off-screen/detached, though, so it silently stays wherever it last was. Nothing reconciles the two once Home becomes visible again — until a real touch-driven swipe happens to force a resync, which is what made it look "fixable by swiping."Fix
Wrap the paging
ScrollViewin aScrollViewReaderand force a real, animation-freeproxy.scrollTo(_:anchor:)to the currentscrollPositionin.onAppear— the same nudge a manual swipe was giving it for free, now applied automatically the instant Home becomes visible again.Verification
🤖 Generated with Claude Code