Repository navigation
fix(pages): keep a newer visit's URL when an older one finishes later - #548
Merged
Merged
Conversation
An older visit whose page update was still running could commit after a newer visit had committed. It wrote its URL, head and scroll over the newer page and disposed the newer page's Deferred props (#507). The engine now tracks the newest visit whose URL is in the address bar: the last commit, or a back/forward visit the browser has already moved to. An older commit is skipped, and commit() reports false. - A visit started while a page mounts (for example a redirect) still lets that page commit first, so a replace targets the right entry. - Same-page hash visits do not count, so a page already on screen keeps its URL in step with it. - The core router skips a view transition callback that a newer visit overtook, and settles a skipped visit like an abandoned one: GET resolves undefined, other methods reject with AbortError. React settles the same way. Fixes #507 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-pages-superseded-commit-void-cloud.voidzero-docs.workers.dev (commit bc3d594)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #507
Summary
An older visit whose page update was still running could commit after a newer visit had already committed. It then wrote its URL, head and scroll over the newer page, and disposed the newer page's Deferred props.
Rule: the address bar only moves forward
makeCommit()inpackages/void/src/pages/navigation-engine.tstracks the newest visit whose URL is in the address bar:a same-page hash visitAn older visit commits only if no newer visit has set the URL.
resource.commit()now resolvestrue/false.Cases
/a(its page is on screen), then B commits/bvisit('/b', { replace: true })/a, B replaces it; the previous entry is kept/a, as before, so page and URL matchI first tried "skip A if any newer visit started" (what Inertia and SvelteKit do). Review showed it breaks redirects made from a page's mount code: the redirect's
replacethen overwrote the previous page's entry. So the rule only looks at visits that have already set the URL.Callers
client.ts(Vue, Svelte, Solid): a skipped visit throws an AbortError insideapplyNavigationResource. The existing catch settles it like any abandoned visit: GET resolvesundefined, other methods reject with AbortError (useFormalready ignores that). A view-transition callback that runs after a newer visit started now skipsapplyUpdate, so the older page cannot paint over the newer one.pages-client.ts):finishNavigationuses the result. A skipped visit settles the same way and does not dispatchfinish.No docs change: nothing changes for users except the bug.
Tests
New
describe('superseded navigation commits (#507)')inpackages/void/test/unit/pages-client.test.ts(10 cases):router.url, title, scroll and B's Deferred prop stay on BEach guard has a test that fails when the guard is removed. 5 of them fail on
main.vp test runpassed except one platform browser test that timed out at 5s under full load. That test runs with JavaScript turned off, so this change doesn't reach it; it passes alone and in its project run twice.vp run test,vp run check,vp lintandvp fmtpass.🤖 Generated with Claude Code