Pages: actions commit the `?actionName` URL to history
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 56/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- react, typescript, vite
- Domain
- frontend
Research direction
Start by tracing makeCommit() and how visits set preserveState and commitTarget.fetchUrl; the issue identifies this history-writing logic as the cause. Compare the behavior with #506 and reproduce using useForm('/db?create', …) or action('/db?create', { data }) on /db. Done means a non-redirecting action keeps /db in the address bar and does not add a history entry for each submission.
Written by the indexing model from the issue text.
Description
Description
When a named action finishes without redirecting, the router writes the action URL into the address bar with pushState. For example, submitting useForm('/db?create', …) on /db leaves the browser at /db?create. Each later submit adds another history entry.
Steps to reproduce
- Define named actions on a page:
// pages/db.server.ts export const actions = { create: defineHandler.withValidator({ body: schema })(async (_c, { body }) => { await createNote(body); }), }; - On
/db, submituseForm('/db?create', …), or callaction('/db?create', { data }). - Check
location.hrefandhistory.length.
Actual behavior
- The address bar shows
/db?create, or/db?deleteafter another action. history.lengthgoes up by one on every submit, so Back steps through each submission before leaving the page.
Expected behavior
An action that re-renders the current page should keep the page's URL (/db). It should either leave the history alone or replace the current entry. The docs describe a void return as "re-runs the loader, page re-renders with fresh props", which suggests staying on the page.
Cause
makeCommit() writes commitTarget.fetchUrl to history for every visit that doesn't set preserveState, including non-GET visits. useForm and action() don't expose preserveState or replace, so callers can't opt out. Returning c.redirect('/db') avoids the wrong URL, but it adds a round trip and still pushes an entry.
Related
#506 changes the same history-writing logic in makeCommit().
Environment
- void 1.1.12
- @void/react 1.1.12
- Dominant language
- TypeScript
- Stars
- 402
- Forks
- 32
- Avg merge
- 10h 51m
- Merged PRs (30d)
- 100
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from voidzero-dev/void
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
voidzero-dev/void#529 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
voidzero-dev/void#428 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 54/100
voidzero-dev/void#525 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 67/100
voidzero-dev/void#524 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 1-2 days Newbie friendliness 52/100
voidzero-dev/void#523 · 1 comment ·
Maintainers usually reply within 1 day
All issues in voidzero-dev/void
Similar issues
-
bug P3 UI/UX
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
StellarState/SS-backend#712 ·
Maintainers usually reply within 1 day
-
area: backend bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
snapotter-hq/SnapOtter#3473 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
gitroomhq/postiz-app#2304 ·
Maintainers usually reply within 1 day
-
harlan-agent-ready-to-implement routine:ci-review
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
harlan-zw/unlighthouse#454 · 2 comments ·
Maintainers usually reply within 1 day