Retry failed locale chunk loads to prevent a permanently stuck boot splash - #97491
Draft
VickyStash wants to merge 3 commits into
Draft
Conversation
Contributor
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
On web, when the locale bundle chunk fails to load (typically a stale app shell after a deploy requesting a chunk hash that no longer exists —
ChunkLoadError: Loading chunk NNNN failed. (missing: …)), the app is left permanently stuck on the full-screen green boot splash:IntlStoreare plain dynamic imports, so unlike the lazy component chunks (covered bylazyRetrysince Clear stale SW caches before reloading on ChunkLoadError #92339) a failed locale chunk rejected with nothing catching it.areTranslationsLoadingstayedtrueforever andcurrentLocalewas never set, sopreferredLocalenever resolved.Expensify.tsxrequires a resolved locale (shouldInit = … && !!preferredLocale), soBootSplash.hide()was never called.Fix:
lazyRetryinto a new genericretryDynamicImport(behavior unchanged for the three component call sites): first failure → plain reload; second failure that is aChunkLoadErrorwhile online → clear service worker caches and reload; anything else → reject.IntlStore.loadthrough it, with retry state scoped per locale (locale:<locale>).sessionStorageaccess in the ladder: if the retry state cannot be read or written (e.g. Safari private browsing), reject instead of reloading — otherwise attempts cannot be counted and the page would reload forever.LocaleTranslationsLoadspan used to end cleanly in.finally, reporting a failed load as a fast successful one. It now ends withfailed: trueon error.locale-load-failed(with the locale inextra). The splash intentionally stays up in that terminal state — with no translations in memory, any screen we could show would render raw translation keys.Fixed Issues
$ #97309
PROPOSAL: N/A
Tests
TBD
Offline tests
Same, as in Tests section
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
MacOS: Chrome / Safari