Skip to content

fix: restore deferred props lost to the bfcache - #5147

Merged
wescopeland merged 2 commits into
RetroAchievements:masterfrom
wescopeland:fix/deferred-props-bfcache-restore
Aug 4, 2026
Merged

wescopeland merged 2 commits into
RetroAchievements:masterfrom
wescopeland:fix/deferred-props-bfcache-restore

Conversation

@wescopeland

Copy link
Copy Markdown
Member

Resolves https://discord.com/channels/310192285306454017/1523653400158277642/1523653400158277642.

The root cause is similar to something we've repaired before with the game page. It's caused by some parts of the UI being in React and others being in Inertia. A full page nav cancels any deferred props request that's still in-flight. This leads to lost deferred props staying in a loading state indefinitely. Screenshots are loaded via deferred props, which is what's causing the reported behavior.

useReloadDeferredOnBackForward solved this problem for a few other game page props. Rather than sprinkling this hook around even more, I've deleted it and lifted the behavior up to a global in our client-side app.tsx:

window.addEventListener('pageshow', restoreDeferredPropsOnPageShow);

This will keep us from forgetting to re-apply it anytime we use deferred props.

@wescopeland
wescopeland requested a review from a team August 2, 2026 18:33
@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Restores deferred props after bfcache navigation.

  • Adds a global pageshow recovery handler.
  • Removes component-specific recovery hooks.
  • Covers missing, nested, grouped, and encrypted history states.

Confidence Score: 5/5

The PR appears safe to merge.

The global handler safely restores unresolved deferred props only after persisted bfcache restores, replacing narrower component hooks.

Reviews (1): Last reviewed commit: "fix: restore deferred props lost to the ..." | Re-trigger Greptile

@Jamiras Jamiras left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could not reproduce locally using steps in discord and a random game. Did not introduce any new issues, so willing to give it a pass.

@wescopeland
wescopeland enabled auto-merge (squash) August 4, 2026 15:23
@wescopeland
wescopeland disabled auto-merge August 4, 2026 15:28
@wescopeland
wescopeland merged commit 07e59fc into RetroAchievements:master Aug 4, 2026
20 of 21 checks passed
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.

2 participants