Skip to content

Keep skeleton rows still on the pages you can't see - #32

Merged
simonhamp merged 1 commit into
mainfrom
fix/still-skeletons-off-screen
Oct 20, 2026
Merged

simonhamp merged 1 commit into
mainfrom
fix/still-skeletons-off-screen

Conversation

@simonhamp

Copy link
Copy Markdown
Member

The Log and Profile pagers lay out the pages beside the one you're on, and the skeleton rows on those pages pulsed forever. A preview page nearly always has one: the row for the commits past its first five, or three of them when nothing is kept. SwiftUI keeps running a looping animation even when its view is off screen, so while the Log was open its async renderer drew frames continuously and, every so often, held the main thread on SwiftUI's lock while it did.

Now only the page you're on pulses. rail-loading takes a pulse flag, and the Log and Profile pages pass showing. A loop only starts when its view appears, so the pulsing column has a key that changes with the flag. A page you swipe to gets a fresh view whose loop starts, instead of keeping the still one.

What it does and doesn't fix

I found this while chasing the scroll stutter on the Log. Sampling the app sitting idle on Latest (simulator, Debug), the main thread spent 220 of about 5,000 samples blocked on that lock. With this change that's zero, and SwiftUI's renderer goes quiet.

It's not the main cause of the stutter, though. On the simulator, dropped frames while flinging the list are the same as before (19 to 25 in either build), and about 5% fewer during load more. The bigger costs are measuring and building rows as they come into view, and the stall each time a new page lands. Those are in core and I'm still on them.

Testing

  • New test in LogCacheTest: the log you're on has a pulsing skeleton, the page beside it doesn't, and after showPage it's the other way round. It fails on main. The full suite passes (1004 tests).
  • In the simulator, with the API made to hang so skeletons stay up: Latest's skeletons pulse, and after switching to Following its skeletons pulse too.

🤖 Generated with Claude Code

The Log and Profile pagers lay out the pages beside the one you're on, and
their skeleton rows pulsed there forever. SwiftUI keeps redrawing a looping
animation even off screen, and every so often it holds the main thread on
its lock while it does. Only the page you're on pulses now. The pulsing
column has a key that changes with it, so a page you swipe to gets a fresh
view whose loop starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp merged commit b07a4ff into main Oct 20, 2026
1 check passed
@simonhamp
simonhamp deleted the fix/still-skeletons-off-screen branch October 21, 2026 16:24
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