Faster app startup: instant cached UI and fewer network round trips#68
Conversation
|
@oliversluke I also mentioned this today in #66 Issue. So a very good step.
|
d6c6c64 to
1a5f92e
Compare
Cold launch waited on the full catalog fetch (up to 15 sequential GraphQL pages) before Home could render, refetched /v2/serverInfo three times in parallel, and never cached the subscription, so resolution and tier appeared late. - Cache the catalog as a JSON file in Caches (too large for tvOS UserDefaults): Home, Store, and last-played render instantly on relaunch while fresh data loads in the background - Cache the subscription in UserDefaults: resolution/FPS options and tier show immediately - Resolve the vpcId once per launch instead of three times, persist it across launches, and revalidate it in the background - Fetch the public catalog in parallel with the browse pagination - Browse with 500-item pages (fallback to 200 if rejected): fewer serial round trips, and it lifts the previous silent 3000-game catalog cap (device now loads the full 5769-game catalog) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1a5f92e to
d282aef
Compare
Review feedback on the startup optimization: - The 200-item retry ran for every error, including auth and network failures, doubling the request volume and masking the real error. browsePages now throws a typed HTTP-status error and the retry runs only for client-error statuses that plausibly mean the 500-item page was rejected (4xx except auth). A GraphQL-level rejection (HTTP 200 with no data) previously produced an empty catalog without ever falling back — an empty result now triggers the retry too. - The scene-activation library refresh also fires on cold launch, fetching the library a second time in parallel with load(). Refreshes are now skipped until the initial load has finished. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@aarikmudgal Both points were right — fixed in 508965f:
While in there I also found that a GraphQL-level rejection of the 500-item page (HTTP 200 with no |
|
@oliversluke Looks good :) One remark, I just noticed that there is a bit of delay when we click on play for any game, before the game art is shown with the loading bar, I know that was part of another PR, but was just wondering if this is a bug and could be fixed easily? Otherwise later today I will test this PR once more and close it. |
|
@aarikmudgal Good catch, and thanks for testing. I traced it: the loading screen's full-bleed background is an Worth noting it's not caused by this PR — #68 caches catalog metadata (the game list), not hero images, so the behavior is identical on It's very fixable though: prefetching the hero image on card focus (warming URLCache) so it's ready by the time Play is pressed. I'll open a separate PR for that shortly. |
aarikmudgal
left a comment
There was a problem hiding this comment.
Tested with FH6 and COD BO6
Problem
On a cold launch the app shows spinners for several seconds before anything useful appears. The causes:
/v2/serverInfo(vpcId) was fetched three times on every launch — the catalog, library, and subscription queries each fetched it independently, and each paid that round trip before starting its real work.Changes
Also includes the signaling double-continuation-resume crash fix from #62 (identical commit; it merges cleanly whichever PR lands first). It fixes a launch-time crash when both signaling candidates connect near-simultaneously, which testing this branch reproduced.
Testing
Device-tested (Apple TV): full 5769-game catalog loads, subscription (Ultimate tier) and library load correctly, relaunch renders Home/Library/Settings instantly from cache, and a full streaming session ran normally.
🤖 Generated with Claude Code