Skip to content

Setups load fast and stay current; every page shows its layout while loading - #307

Merged
kratofl merged 6 commits into
mainfrom
feat/setups-index-and-loaders
Dec 5, 2026
Merged

kratofl merged 6 commits into
mainfrom
feat/setups-index-and-loaders

Conversation

@kratofl

@kratofl kratofl commented Dec 5, 2026

Copy link
Copy Markdown
Owner

The Setups page could sit on a grey block for a long time, and never showed a setup saved in the game while Sprint was running.

Setups load from an index

After every start, Sprint parsed every setup file in the game folder and every stored version (930 JSON files, 19 MB in the dev data) before the list appeared. A small cache, setup-index.json, now remembers each setup's path, timestamp, current version and car, plus the versions without their values. A restart reads only the setups the game changed; a version's values are read only when it is opened. Missing, unreadable or half-written, the index is rebuilt from the stored versions. A version whose stored values are gone is read from the game's file again.

Setups stay current

A watcher on the game's setup folder looks at it when the game writes a setup. A setupsRevision in /api/state then makes the list, an open setup and a comparison fetch again. The first look runs in the background at start, so the list is ready before the page is opened.

Loaders shaped like the page

Every page drew one grey block while loading. Each now draws its own layout in static placeholder shapes (shell/Skeleton.tsx): tool row, cards, rows, tiles, and charts as an empty plot with gridlines. No shimmer or pulse. The preview gains loading=1 to screenshot them.

Dash designer fix

In a dash version, the placeholder for a removed widget is opaque and hid any widget put in its spot. It now only shows while its cells are free.

Checks

  • dotnet build app/Sprint.Desktop.slnx -warnaserror: clean.
  • Desktop tests: 1221 passing, 4 new for the index and watcher. Desktop TS: 347 passing.
  • Host tests: 9 fail locally, all because sprint_dash.dll is built for the wrong architecture for the x86 test process. Unrelated to this change.
  • Loaders looked at on all ten pages (dark), Home and Setups (light), Home (Mac look).
  • Not tried in the real app with the game: saving a setup in the garage while the Setups page is open, and how much faster a restart is with real data.
  • Reviewed in a fresh context; the one real finding (a version whose snapshot failed to save stayed broken) is fixed.

🤖 Generated with Claude Code

kratofl and others added 6 commits December 5, 2026 14:31
In a dash version, an inherited widget the version removed shows as an opaque dashed
placeholder with "Bring back". Putting another widget where it sat left the new widget
hidden behind that placeholder. The placeholder now only shows while its cells are free;
the removal still counts in the scope strip and Reset still undoes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every page drew a flat grey block while its data arrived, and the Setups page could sit
on it for a long time. Each page now draws its own layout in static placeholder shapes
(tool row, cards, rows, tiles, charts as an empty plot with gridlines), so it reads as
loading and doesn't jump when the data lands. No shimmer or pulse: the shapes never repaint.

The shapes live in shell/Skeleton.tsx so new pages build theirs from the same parts.
The preview gains loading=1, which keeps every page on its loader for screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Setups page could load for a long time: after every app start, Sprint parsed every
setup file in the game folder and every stored version (930 JSON files, 19 MB in the dev
data) before the list appeared. A small index file (setup-index.json) now remembers each
setup's path, timestamp, current version and car, plus the versions without their values.
A restart reads only the setups the game changed, and a version's values only when it is
opened. The index is a cache: missing or unreadable, it is rebuilt from the stored versions.

The page also only reloaded when opened, so a setup saved in the game while Sprint ran for
hours never showed. A watcher on the game's setup folder now looks at it when the game
writes, and a revision in the app state makes the list, an open setup and a comparison
fetch again. The first look runs in the background at start, so the list is ready early.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review. A setup version whose snapshot failed to save (disk full, a locked file) was
still indexed, so the setup would not open and never recovered after a restart. A failed
save now leaves the file unindexed so the next look retries, and a version whose stored
values are gone is read from the game's file again when opened.

Also: an index that parses but lacks fields is rebuilt instead of breaking the page; a
folder watcher that errs is replaced on the next visit; loading tiles no longer react to
hover; the unused .skeleton rule is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's export keeps each version's original file in its snapshot and fills it in for
versions captured before. The index now records whether a version has its original, so
that backfill still happens without loading every snapshot, and export loads only the
version it writes out. The Setups page keeps main's notices and export alongside the
live refresh and its loader; the preview's loading=1 also holds capture mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI failed on Rgb565Tests.FusedCompositionIsAllocationFree, which asserts that composing
frames allocates nothing on its thread. Locally it failed in about 1 of 10 runs, and only
alongside the new watcher test, which polled with await Task.Delay on xUnit's shared worker
threads. Waiting with SpinWait.SpinUntil on the test's own thread instead: 0 of 20 runs failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kratofl
kratofl merged commit 2a6668d into main Dec 5, 2026
3 checks passed
@kratofl
kratofl deleted the feat/setups-index-and-loaders branch December 5, 2026 15:36
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