Skip to content

fix(dashboard): reveal streamed pages while the tab is hidden (#16245) - #16930

Merged
diegosouzapw merged 1 commit into
release/v3.8.52from
fix/16245-hidden-tab-reveal
Oct 17, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.52from
fix/16245-hidden-tab-reveal

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Closes #16245

Root cause

React Fizz's $RC reveal runtime gates the first Suspense boundary swap on requestAnimationFrame unless the global $RT is already a number. rAF never fires in a hidden/occluded tab, and src/app/loading.tsx makes 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: exports HIDDEN_TAB_REVEAL_SCRIPT, which seeds window.$RT = performance.now() when document.visibilityState === "hidden", so $RC takes the setTimeout path.
  • src/app/layout.tsx: injects it as the first <head> script via dangerouslySetInnerHTML, the same pattern as the existing pre-hydration scripts (no nonce handling exists there).
  • Changelog fragment 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.

  • RED (without the script): AssertionError: fallback 'Loading OmniRoute...' must be gone.
  • GREEN (with the shipped script): 2 pass, 0 fail.
    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:core exit 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.

⚠️ base-red inherited: #15306 — full unit suite ceiling, Vitest MCP audit shutdown, integration suite ceiling, package-artifact, tarball boot-smoke, ci.yml lint check:ai-attribution range step (not touched by this PR).

@github-actions

Copy link
Copy Markdown
Contributor

CI Coverage Report

  • Coverage job: skipped
  • PR test policy: success

Coverage artifact was not available for this run.

@diegosouzapw
diegosouzapw merged commit 2cbdcd7 into release/v3.8.52 Oct 17, 2026
46 of 65 checks passed
@diegosouzapw
diegosouzapw deleted the fix/16245-hidden-tab-reveal branch October 18, 2026 23:49
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.

fix: /home and /dashboard/* stuck on "Loading OmniRoute..." while the tab is hidden (rAF-gated reveal)

1 participant