-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Labels
Dynamic RoutesRelated to dynamic routes.Related to dynamic routes.Server ActionsRelated to Server Actions.Related to Server Actions.
Description
Link to the code that reproduces this issue
https://github.com/newportandy/next-16-action-queue-race-condition
To Reproduce
- npm install && npm run build
- npm start
- Open http://localhost:3000/page-a
- While the yellow "Loading..." box is showing (50 fast server actions queuing up), click the blue "Navigate to Page B" button
- Wait for Page B to render, you'll see what the current
state.canonicalUrlis set to (it alternates as the two thread fight over it) - Depending on which thread ran last, clicking "Save" on Page B will either work as expected or redirect you incorrectly to /page-a
Current vs. Expected behavior
Current behaviour:
Depending on which thread ran last, submitting a server action on page B will either correctly stay on page B, or it will redirect to page A.
Expected behaviour:
The server action doesn't redirect to page A arbitrarily.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:08 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8122
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 22.12.0
npm: 10.9.0
Yarn: 1.22.22
pnpm: 10.8.0
Relevant Packages:
next: 16.2.0-canary.59 // Latest available version is detected (16.2.0-canary.59).
eslint-config-next: N/A
react: 19.2.4
react-dom: 19.2.4
typescript: 5.9.3
Next.js Config:
output: standaloneWhich area(s) are affected? (Select all that apply)
Dynamic Routes, Server Actions
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local), Other (Deployed)
Additional context
This issue seems to first appear in 16.0.0, testing with 15.5.12 doesn't surface the same state corruption issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Dynamic RoutesRelated to dynamic routes.Related to dynamic routes.Server ActionsRelated to Server Actions.Related to Server Actions.