Different behavior for dev and prod builds for client components within a layout #61914
Labels
bug
Issue was opened via the bug report template.
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Link to the code that reproduces this issue
https://github.com/EugeneDraitsev/next-routing-issue
To Reproduce
yarn dev
or check it on codesandbox (deployed app link)Recording.2024-02-11.184517.mp4
yarn build
andyarn start
or check it on vercelRecording.2024-02-11.184606.mp4
Current vs. Expected behavior
Expected behavior: Dev and prod work the same (in an ideal scenario the dev behavior should be correct)
Current behavior: For some reason in the prod build the
<Header />
component is remounted and dev/prod behaves differently.Btw, everything works as expected on dev and prod builds if I add
'use client'
tolayout.js
(which is a very bad workaround).Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: