Repository navigation
fix(dashboard): reveal streamed pages while the tab is hidden (#16245) - #16930
Merged
Merged
Conversation
Contributor
CI Coverage Report
Coverage artifact was not available for this run. |
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.
Closes #16245
Root cause
React Fizz's
$RCreveal runtime gates the first Suspense boundary swap onrequestAnimationFrameunless the global$RTis already a number. rAF never fires in a hidden/occluded tab, andsrc/app/loading.tsxmakes every route stream behind a Suspense fallback, so "Loading OmniRoute..." stays until the tab is shown. Upstream: React #36741, Next.js #95588.What changed
src/shared/utils/hiddenTabReveal.ts: exportsHIDDEN_TAB_REVEAL_SCRIPT, which seedswindow.$RT = performance.now()whendocument.visibilityState === "hidden", so$RCtakes the setTimeout path.src/app/layout.tsx: injects it as the first<head>script viadangerouslySetInnerHTML, the same pattern as the existing pre-hydration scripts (no nonce handling exists there).changelog.d/fixes/16245-hidden-tab-reveal.md.Regression test
tests/unit/hidden-tab-suspense-reveal-16245.test.ts(jsdom, rAF stubbed as never firing, real React streamed HTML): imports the shipped constant and asserts the fallback is replaced; plus a static guard that layout.tsx injects it.AssertionError: fallback 'Loading OmniRoute...' must be gone.The no-script baseline case was dropped from the committed file because it would fail by design.
Gates run
eslint (with suppressions) clean, prettier,
typecheck:coreexit 0, check-file-size, check-complexity, check-cognitive-complexity, check-changelog-integrity all OK, sibling layout tests (material-icons-self-hosted, hydration-extension-attrs) pass, pre-commit hooks passed.Manual production-build browser check was not done by the author; the owner validates it. Caveat: relies on the private React global
$RT; if renamed upstream the script becomes a no-op.