Skip to content

Duplicate metadata from generateMetadata after Server Action revalidation #83510

@y-hsgw

Description

@y-hsgw

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/metadata-server-action-dyq7yh?file=%2Fapp%2Fpage.tsx%3A8%2C5

To Reproduce

  1. Run next dev.
  2. Open your browser’s DevTools (Elements panel).
    You’ll see the <title> and the <meta name="description"> rendered twice.
Image

Current vs. Expected behavior

Current: <title> and description are duplicated.

Expected: <title> and description are not duplicated.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.5.1-canary.30 // Latest available version is detected (15.5.1-canary.30).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.3.3
Next.js Config:
  output: N/A

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

Server Actions, Metadata

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

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

Additional context

It might be because I’m triggering Server Action revalidation inside useEffect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MetadataRelated to Next.js' Metadata API.Server ActionsRelated to Server Actions.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions