Skip to content

Fix hero carousel freezing while Home is covered/backgrounded - #88

Merged
imbenjamin merged 1 commit into
developfrom
fix/hero-carousel-scroll-desync
Aug 17, 2026
Merged

Fix hero carousel freezing while Home is covered/backgrounded#88
imbenjamin merged 1 commit into
developfrom
fix/hero-carousel-scroll-desync

Conversation

@imbenjamin

Copy link
Copy Markdown
Owner

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-advance tickTimer isn't gated on the view's on-screen visibility. Because a pushed detail screen (and the Player, presented via .fullScreenCover from there) sits above Home in the same NavigationStack, Home stays mounted underneath rather than being torn down — so the timer keeps ticking and writing to the scrollPosition state var (which the dot indicator is a pure function of) the whole time it's covered. The real backing UIScrollView can'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 ScrollView in a ScrollViewReader and force a real, animation-free proxy.scrollTo(_:anchor:) to the current scrollPosition in .onAppear — the same nudge a manual swipe was giving it for free, now applied automatically the instant Home becomes visible again.

Verification

  • Live-reproduced the original bug on the Simulator (screenshots of the dot advancing while content stayed frozen), confirmed a manual swipe "unstuck" it.
  • Rebuilt with the fix, reproduced the same cover/return sequence (push into a detail screen, wait through a couple of auto-advance ticks, pop back) — hero content now matches the dot immediately, no manual nudge needed, and auto-advance keeps running smoothly afterward.
  • Full test suite: 469 tests passing.

🤖 Generated with Claude Code

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>
@imbenjamin
imbenjamin merged commit 0e670bf into develop Aug 17, 2026
2 checks passed
@imbenjamin
imbenjamin deleted the fix/hero-carousel-scroll-desync branch August 17, 2026 18:37
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