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

Top-level root layout is computed twice #52093

Closed
1 task done
joulev opened this issue Jul 2, 2023 · 3 comments
Closed
1 task done

Top-level root layout is computed twice #52093

joulev opened this issue Jul 2, 2023 · 3 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@joulev
Copy link
Contributor

joulev commented Jul 2, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:21:34 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8112
    Binaries:
      Node: 20.3.1
      npm: 9.6.7
      Yarn: 1.22.19
      pnpm: 8.6.5
    Relevant Packages:
      next: 13.4.8-canary.14
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.3
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue or a replay of the bug

https://github.com/joulev/debug/tree/nextjs-root-layout-computed-twice-for-dynamic-routes

To Reproduce

  • next build
  • next start
  • Navigate to /

Describe the Bug

The root layout is computed twice.

$ pnpm start

> test-rsc-with-mdx@0.1.0 start /Users/joulev/dev/www/debug
> next start

- ready started server on 0.0.0.0:3000, url: http://localhost:3000
Computing layout with incoming pathname: /
Computing layout with incoming pathname: /

Interestingly, that only happens to the top-level root layout (app/layout.tsx). If I add a directory in-between use something like

$ tree ./app       
app
└── (group)
    ├── layout.tsx
    └── page.tsx

2 directories, 2 files

then the (still root) layout is not computed twice.

Expected Behavior

The root layout should only be computed once, like the case where it is not exactly app/layout.tsx as shown above.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

next start

@joulev joulev added the bug Issue was opened via the bug report template. label Jul 2, 2023
@izica
Copy link

izica commented Jul 4, 2023

nextjs v13.4.8 same bug

@balazsorban44
Copy link
Member

Thanks, this is a duplicate of #49115 so I'm closing.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Aug 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

3 participants