-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Open
Open
Copy link
Labels
Dynamic RoutesRelated to dynamic routes.Related to dynamic routes.Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.Related to Next.js linking (e.g., <Link>) and navigation.RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.Server ActionsRelated to Server Actions.Related to Server Actions.
Description
Link to the code that reproduces this issue
https://github.com/ellemedit/nextjs-dynamic-route-back
To Reproduce
bun install && bun dev
- access
http://localhost:3000/1
- you will see
id: 1
- click
go to next page by link
- you will see
id: 2
- click
go to next page with server action and router in client component
- you will see
id: 3
- click navigate back by browser
- you still see
id: 3
but the location is already changed tohttp://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
kenzycodex
Metadata
Metadata
Assignees
Labels
Dynamic RoutesRelated to dynamic routes.Related to dynamic routes.Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.Related to Next.js linking (e.g., <Link>) and navigation.RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.Server ActionsRelated to Server Actions.Related to Server Actions.