-
Couldn't load subscription status.
- Fork 29.7k
Description
Link to the code that reproduces this issue
https://github.com/SorooshGb/nextjs-portal-cache-issue-repro
To Reproduce
- Clone the repo linked above and run
npm install. - Start the app with
npm run dev. - Open the Home page (
/) — you’ll see 4 dropdown menus, each using a different implementation:- Radix UI / shadcn dropdown
- Raw React portal example
- React Aria popover
- Headless UI popover
- Open any of the dropdowns/popovers.
- Inside each one, click the link that navigates to
/dashboard. - After navigation, notice that the portaled content remains visible on the new route and doesn’t go away until you refresh the page.
Current vs. Expected behavior
Current behavior:
When cacheComponents: true is enabled in Next.js 16, any open portal (dropdown, popover, modal, etc.) stays visible on the screen after navigation and becomes completely non-interactive.
Its DOM node persists in the document and can only be cleared by refreshing the page.
Expected behavior:
Portal content should disappear (be unmounted) automatically when navigating to a new route, as it does when cacheComponents is set to false or in previous Next.js versions.
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home
Available memory (MB): 32493
Available CPU cores: 12
Binaries:
Node: 22.16.0
npm: 11.4.2
Yarn: 1.22.22
pnpm: 10.13.1
Relevant Packages:
next: 16.0.0 // Latest available version is detected (16.0.0).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.8.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
cacheComponents
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
This issue appears to have been introduced in Next.js 16 — it does not happen in previous versions.
A comment in the related issue (#85218) points to a specific PR that might have caused it:
#85218 (comment)
I’m creating this new issue with a more accurate title to bring attention to how critical this problem is, since the existing reports don’t fully explain or demonstrate it: