Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next 13 - Every client component from the root layout is unmounted and mounted again on navigation #44901

Open
1 task done
dumbravaandrei22 opened this issue Jan 15, 2023 · 1 comment
Labels
template: bug A user has filled out the bug report template. Issue needs triaging

Comments

@dumbravaandrei22
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js 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

  1. Go here: https://stackblitz.com/edit/vercel-next-js-wzcg3h?file=app%2Fabout%2Fpage.tsx
  2. npm run build (the sandbox starts by default in dev mode, that doesn't work, don't know why)
  3. npm run start
  4. Click on "Go to About Page"
  5. See the logs:
    image

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

@dumbravaandrei22 dumbravaandrei22 added the template: bug A user has filled out the bug report template. Issue needs triaging label Jan 15, 2023
@Rishab49
Copy link

refer to this discussion #10832
maybe it can help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template: bug A user has filled out the bug report template. Issue needs triaging
Projects
None yet
Development

No branches or pull requests

2 participants