mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 00:09:23 +02:00
[PR #1100] fix(router): reject stale same-url server action commits #1095
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#1095
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/1100
Author: @NathanDrake2406
Created: 5/6/2026
Status: 🔄 Open
Base:
main← Head:nathan/726-core-04-stale-actions📝 Commits (2)
f2b1e69fix(router): reject stale same-url server action commits7b84a43fix(router): preserve server action initiation version📊 Changes
5 files changed (+178 additions, -9 deletions)
View changed files
📝
packages/vinext/src/server/app-browser-entry.ts(+8 -1)📝
packages/vinext/src/server/app-browser-navigation-controller.ts(+5 -7)📝
packages/vinext/src/server/app-browser-state.ts(+10 -0)📝
packages/vinext/src/server/app-browser-visible-commit.ts(+7 -1)📝
tests/app-browser-entry.test.ts(+148 -0)📄 Description
What this changes
Implements #726-CORE-04 from #726 by rejecting stale same-URL server-action visible commits. A server action that started from an older visible router state can still return its action value, but it can no longer overwrite newer visible state once another commit has advanced the lifecycle version.
Why
Issue #726 calls out that
activeNavigationIdis not enough for same-URL refresh and server-action races. Same URL does not mean same visible world. Before this change, two same-URL server actions resolving out of order could let the older RSC payload commit after the newer one had already updated the route.That violated the lifecycle spine invariant from #726: no stale operation commits visible state, and no older server-action result overwrites newer visible state.
Approach
startedVisibleCommitVersionwith the current router statevisibleCommitVersion.Non-goals: this does not model discarded revalidation, redirect lifecycle, cache reuse authority, or the broader NavigationPlanner work from issue #726.
Validation
vp test run tests/app-browser-entry.test.tsvp check packages/vinext/src/server/app-browser-navigation-controller.ts packages/vinext/src/server/app-browser-state.ts packages/vinext/src/server/app-browser-visible-commit.ts tests/app-browser-entry.test.tsvp run vinext#buildvp run vinext#buildcompleted with the existing virtual-module external warnings forvirtual:vinext-rsc-entry,virtual:vite-rsc/client-references, andprivate-next-instrumentation-client.Review note
Bonk: please read issue #726 to see the big picture before reviewing this PR. This is specifically the #726-CORE-04 slice, not the full lifecycle, planner, cache, or compatibility architecture.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.