8000 RouterBFCache breaks backward navigation when dynamic segment use server action · Issue #79779 · vercel/next.js · GitHub
[go: up one dir, main page]

Skip to content
RouterBFCache breaks backward navigation when dynamic segment use server action #79779
@ellemedit

Description

@ellemedit

Link to the code that reproduces this issue

https://github.com/ellemedit/nextjs-dynamic-route-back

To Reproduce

  1. bun install && bun dev
  2. access http://localhost:3000/1
  3. you will see id: 1
  4. click go to next page by link
  5. you will see id: 2
  6. click go to next page with server action and router in client component
  7. you will see id: 3
  8. click navigate back by browser
  9. you still see id: 3 but the location is already changed to http://localhost:3000/1

video:
https://github.com/user-attachments/assets/4e850881-fa8d-4190-bb26-c4a467d0d191

Current vs. Expected behavior

the history stack changed but still render previous rendering contents when server action invoked previously

it should respect previous history screen

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 131072
  Available CPU cores: 16
Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.15.9
Relevant Packages:
  next: 15.4.0-canary.53 // There is a newer canary version (15.4.0-canary.55) available, please upgrade! 
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

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

Linking and Navigating, Dynamic Routes, Server Actions, Runtime

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

next dev (local), next build (local), Other (Deployed)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dynamic RoutesRelated to dynamic routes.Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.RuntimeRelated to Node.js or Edge Runtime with Next.js.Server ActionsRelated to Server Actions.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0