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

not-found loses context from layout on the re-occurring render #53147

Open
1 task done
ChiefORZ opened this issue Jul 25, 2023 · 4 comments
Open
1 task done

not-found loses context from layout on the re-occurring render #53147

ChiefORZ opened this issue Jul 25, 2023 · 4 comments
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.

Comments

@ChiefORZ
Copy link

ChiefORZ commented Jul 25, 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: x64
  Version: Darwin Kernel Version 21.6.0: Thu Jun  8 23:57:12 PDT 2023; root:xnu-8020.240.18.701.6~1/RELEASE_X86_64
Binaries:
  Node: 18.16.0
  npm: 9.5.1
  Yarn: 1.22.19
  pnpm: 8.6.10
Relevant Packages:
  next: 13.4.13-canary.0
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.6
Next.js Config:
  output: N/A

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

App Router

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

https://codesandbox.io/p/sandbox/elegant-joji-mxx7fn

To Reproduce

  1. Visit the CodeSandbox above
  2. Routing to /abc via a <Link /> - works
  3. Routing to /abc in the browser explodes 💥

Describe the Bug

To use next-intl you are supposed to use the <Link /> provided by next-intl/link. This needs a context provided by next-intl. This is done in the root layout.tsx (app/[locale]/layout.tsx). This worked fine with version 13.4.9

I tracked it down that the layout.tsx does not render on re-occurring renders - if you load the page and look at the console you can see:

[...not-found]/page.tsx
layout.tsx
not-found.tsx

[...not-found]/page.tsx
not-found.tsx
Error: No intl context found. Have you configured the provider?

On the first render the layout.tsx gets loaded perfects, on the second render the layout is skipped and therefore the context is not provided. It could be introduced by this PR #52589

Expected Behavior

The layout.tsx should be run on every render.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1471

@amannn
Copy link
Contributor

amannn commented Jul 25, 2023

Thank you for the great reproduction @ChiefORZ!

I've created an additional reproduction without next-intl, to make sure that it's not a library bug: CodeSandbox.

If you open https://sjdjxn-3000.csb.app/en/abc, you'll see false being rendered. This is a value from context that is configured in app/[locale]/layout.tsx. Navigating via Link works, as mentioned above.

@dalechyn

This comment was marked as off-topic.

@balazsorban44 balazsorban44 added the linear: next Confirmed issue that is tracked by the Next.js team. label Jul 26, 2023
@dalechyn
Copy link

I can reproduce the same issue in a production build with other layouts, not just not found page.

@hipdev
Copy link

hipdev commented Sep 9, 2023

I'm having the same issue, a reload fixes it, but is very odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.
Projects
None yet
Development

No branches or pull requests

5 participants