Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Pages: actions commit the `?actionName` URL to history

Aperta
#527 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript, vite
Ambito
frontend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

  1. Define named actions on a page:
    // pages/db.server.ts
    export const actions = {
      create: defineHandler.withValidator({ body: schema })(async (_c, { body }) => {
        await createNote(body);
      }),
    };
    
  2. On /db, submit useForm('/db?create', …), or call action('/db?create', { data }).
  3. Check location.href and history.length.

Actual behavior

  • The address bar shows /db?create, or /db?delete after another action.
  • history.length goes 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
Lingua principale
TypeScript
Stelle
402
Fork
32
Merge medio
10h 51m
PR unite (30g)
100

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di voidzero-dev/void

Tutte le issue di voidzero-dev/void

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.