Next 13 - Every client component from the root layout is unmounted and mounted again on navigation #44901
Labels
template: bug
A user has filled out the bug report template. Issue needs triaging
Verify canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: Ubuntu 20.04.0 LTS Sun Jan 15 2023 18:53:52 GMT+0200 (Eastern European Standard Time)
Binaries:
Node: 16.14.2
npm: 7.17.0
Yarn: 1.22.19
pnpm: 7.13.6
Relevant packages:
next: 13.1.3-canary.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue
https://stackblitz.com/edit/vercel-next-js-wzcg3h?file=app/about/page.tsx
To Reproduce
Describe the Bug
The client components from the root layout are unmounted and mounted again when you navigate through Links.
In the following sandbox, I created two pages HomePage + AboutPage.
There you will see a root layout having the TestComponent in it.
In the test component, I made an effect where I logged mount and unmount triggers.
This issue is reproducible in build mode.
This issue can also be reproducible in dev mode if the reactStrictMode is true (default).
(I posted on this thread some time ago: #42164 (comment))
Expected Behavior
The client components from the Rootlayout should not unmount on link navigation.
Which browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: