Repository navigation
Conversation
Fixes voidzero-dev#527 ## Summary Named actions no longer pollute history when they re-render the current page. voidzero-dev#530 already removed `?actionName` from the committed URL; voidzero-dev#531 still used `pushState` for every mutation, so each `useForm('/db?create')` / `action()` submit added another back-stack entry at `/db`. - Same-document mutations use `replaceState` instead of `pushState`. - `mutationCommitUrl()` prefers the server `pageData.url` when the action updates query params on the same path (e.g. `POST /books?delete` → `/books?page=2` still pushes once). ## Tests Updated POST history expectations to `replaceState` when the browser URL already matches the committed page URL. Added coverage for URL-changing POSTs and repeated same-page named-action submits. `vp test run packages/void/test/unit/pages-client.test.ts` — 69/69 passed. Co-authored-by: froQ <sayhola@froq.me>
This branch has not been deployed
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 #527
Summary
Named actions no longer pollute history when they re-render the current page. #530 already removed
?actionNamefrom the committed URL; #531 still usedpushStatefor every mutation, so eachuseForm('/db?create')/action()submit added another back-stack entry at/db.replaceStateinstead ofpushState.mutationCommitUrl()prefers the serverpageData.urlwhen the action updates query params on the same path (e.g.POST /books?delete→/books?page=2still pushes once).Tests
Updated POST history expectations to
replaceStatewhen the browser URL already matches the committed page URL. Added coverage for URL-changing POSTs and repeated same-page named-action submits.vp test run packages/void/test/unit/pages-client.test.ts— 69/69 passed. 🐸