mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1061] [MERGED] feat(app-router): track visible commit versions for browser operations #1060
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#1060
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/1061
Author: @NathanDrake2406
Created: 5/5/2026
Status: ✅ Merged
Merged: 5/5/2026
Merged by: @james-elicx
Base:
main← Head:nathan/726-core-01-operation-record📝 Commits (1)
28ed7a0feat(app-router): track visible commit versions for browser operations📊 Changes
5 files changed (+313 additions, -70 deletions)
View changed files
📝
packages/vinext/src/server/app-browser-entry.ts(+22 -0)📝
packages/vinext/src/server/app-browser-navigation-controller.ts(+12 -0)📝
packages/vinext/src/server/app-browser-state.ts(+111 -20)📝
tests/app-browser-entry.test.ts(+159 -46)📝
tests/prefetch-cache.test.ts(+9 -4)📄 Description
What this changes
Implements
#726-CORE-01from #726 by adding the first browser-visible lifecycle spine to the App Router browser state. Browser router state now carriesvisibleCommitVersionand the operation that produced the currently visible router-state commit.Why
Issue #726 calls out that
activeNavigationIdis not enough lifecycle authority for same-URL refresh and server-action races. Before this PR, browser-visible router state changed without a versioned commit baseline or a typed operation record, which made later stale-result gates impossible to express cleanly.visibleCommitVersionintentionally names the router lifecycle commit baseline from #726. It advances when the reducer accepts a new visible router-state commit; it is not a React DOM paint signal.Approach
OperationRecordtypes with explicit lanes for navigation, refresh, traverse, server-action, and HMR work.visibleCommitVersionandactiveOperationtoAppRouterState, initialized at hydration version0.commitVisibleRouterState, which is the only owner that incrementsvisibleCommitVersionand stamps the committed operation.router.prefetch()fetch side effect instead of assuming one timer tick is enough.Non-goals for this PR: it does not introduce
ApprovedVisibleCommit,NavigationPlanner, broad cache coherence, or the stale same-URL server-action rejection planned for later#726-CORE-04. This PR intentionally creates the versioned ownership data those later gates need.Validation
vp check packages/vinext/src/server/app-browser-state.ts packages/vinext/src/server/app-browser-navigation-controller.ts packages/vinext/src/server/app-browser-entry.ts tests/app-browser-entry.test.ts tests/prefetch-cache.test.tsvp test run tests/app-browser-entry.test.ts tests/prefetch-cache.test.tsvp test run --project unitgit diff --checkvp check --fixplusknip --no-progressRisks / follow-ups
The known same-URL server-action stale commit race is still deliberately left in place and documented in code. The observable behavior is unchanged here; follow-up
#726-CORE-04should usestartedVisibleCommitVersionto reject or reroute stale same-URL commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.