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

Intercepted routes don't update metadata #72938

Open
pseudotsuga-fir opened this issue Nov 18, 2024 · 1 comment
Open

Intercepted routes don't update metadata #72938

pseudotsuga-fir opened this issue Nov 18, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. Metadata Related to Next.js' Metadata API. Parallel & Intercepting Routes Related to Parallel and/or Intercepting routes.

Comments

@pseudotsuga-fir
Copy link

pseudotsuga-fir commented Nov 18, 2024

Link to the code that reproduces this issue

https://github.com/pseudotsuga-fir/nextgram-broken-metadata

To Reproduce

  1. Add unique metadata to an intercepted route
export async function generateMetadata({
  params,
}: {
  params: Promise<{ id: string }>;
}): Promise<Metadata> {
  const id = (await params).id;

  return {
    title: `Page ${id} intercepted`,
  };
}
  1. Add link to a page that leads to intercepted route, see that intercepted page does not change the metadata

Current vs. Expected behavior

Current

Metadata remains the same as the current page when intercepting a route, despite the intercepted route providing its own metadata. The metadata for the intercepted route WILL display however under the specific circumstance of navigating as such via the <Link> component: Page 1 (provides custom metadata) > Page 2 (does not provide metadata) > Intercepted Route (provides custom metadata).

Screenshot 2024-11-18 at 2 49 26 PM

Expected

Metadata updates upon navigating to an intercepted route based on the metadata provided in the page of that route.

Screenshot 2024-11-18 at 2 49 58 PM

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 22.2.0: Fri Nov 11 02:06:26 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8112
  Available memory (MB): 24576
  Available CPU cores: 8
Binaries:
  Node: 20.18.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: 8.9.0
Relevant Packages:
  next: 15.0.3 // Latest available version is detected (15.0.3).
  eslint-config-next: N/A
  react: 19.0.0-rc-fb9a90fa48-20240614
  react-dom: 19.0.0-rc-fb9a90fa48-20240614
  typescript: 5.6.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Metadata, Parallel & Intercepting Routes

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

Working example: Repo and Live

This bug was fixed in v14.0.5-canary.24, likely by one of these two pull requests:

The last working version was v14.1.4; I was unable to find which canary version or commits broke this. Issue has remained present since.

Does not work in current canary version as of writing this issue: v15.0.4-canary.18

@pseudotsuga-fir pseudotsuga-fir added the bug Issue was opened via the bug report template. label Nov 18, 2024
@github-actions github-actions bot added Metadata Related to Next.js' Metadata API. Parallel & Intercepting Routes Related to Parallel and/or Intercepting routes. labels Nov 18, 2024
@samcx
Copy link
Member

samcx commented Nov 21, 2024

@pseudotsuga-fir I was able to replicate this! We are taking a look :one-eye-cowboy:

@samcx samcx added the linear: next Confirmed issue that is tracked by the Next.js team. label Nov 21, 2024
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. Metadata Related to Next.js' Metadata API. Parallel & Intercepting Routes Related to Parallel and/or Intercepting routes.
Projects
None yet
Development

No branches or pull requests

2 participants