[Turbopack] Pages Router hydration delayed when tab opened in background
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.5k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/happyjosh/turbopack-pages-router-bug
To Reproduce
- Create minimal
_app.tsxwith timing logs - Use
yarn dev --turbopack - Middle-click a link to open page in background tab
- Switch to the new tab and check console logs
Current vs. Expected behavior
When opening a Pages Router page in a background tab (middle-click or right-click -> open in new tab), the hydration is significantly delayed until the tab becomes visible.
Observed behavior:
- Module loads at ~1200ms with
visibilityState: hidden - App render happens at ~9200ms with
visibilityState: visible - ~8 seconds delay between module load and React hydration
Expected behavior:
Hydration should complete regardless of tab visibility.
Provide environment information
- Next.js: 16.x
- React: 19.x
- Turbopack: enabled
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
Key Finding
- Pages Router + Turbopack: Has this delay
- App Router + Turbopack: Works correctly (no delay)
- Pages Router + Webpack: Works correctly (no delay)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked happyjosh/turbopack-pages-router-bug reproduction with yarn dev --turbopack, beginning with its minimal _app.tsx and console timing logs. Compare Pages Router with App Router and Webpack under a background-tab load; done means Pages Router hydration completes without waiting for the tab to become visible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, react
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100