Pages: preserveState prevents the destination URL from being committed
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript, vite
- Domaine
- backend-api-design, frontend
Piste de recherche
Start in packages/void/src/pages/navigation-engine.ts, especially makeCommit() and its history-writing condition, then trace how normal visits, router.refresh(), and back/forward navigation select commit behavior. Run the reported unit tests with vp test run and locate the shared-router regression tests. Done means preserveState visits update the URL, replace still replaces, refresh and history navigation add no entries, and tests cover state preservation and URL behavior.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
Calling router.visit('/settings', { preserveState: true }) updates the rendered page, but leaves the browser URL pointing to the previous page.
This appears to couple component state preservation with history updates.
Environment
- Commit:
2ceab89154dc6e0c3fa5525f7bd4d1d5f3d0aa64 - Package version in the repository:
1.1.12 - Chromium Headless Shell:
134.0.6998.35 - Playwright:
1.64.1
Steps to reproduce
- Start on
/case. - Navigate using:
await router.visit('/settings', {
preserveState: true,
});
- Return a valid Pages response for
/settings. - Compare the rendered page with
window.location.pathname.
Actual behavior
The destination page renders, but the address bar remains on /case.
In an isolated browser fixture using the production createVoidRouter():
| Value | Result |
|---|---|
| Rendered page | /settings |
window.location.pathname |
/case |
router.path after the visit |
/case |
This reproduced in all three browser runs. A direct regression test against the shared router also fails because history.pushState() is not called.
The unit tests were run with vp test run. The browser fixture was run separately through a Node.js script using Playwright; it was not run as an existing Void browser integration suite. The fixture exercises the actual client runtime with a small HTTP server; this was not a full production-build test across every adapter.
Expected behavior
The rendered page and browser URL should both reflect /settings.
preserveState should control component state preservation independently of whether a normal visit writes history. replace should continue to select between replacing and adding an entry.
Relevant implementation
In makeCommit(), history updates are skipped whenever preserveState is true:
if (!options.preserveState) {
const historyUrl = commitTarget.fetchUrl + commitTarget.hash;
scrollRestoration.writeHistory(historyUrl, !!options.replace);
}
Separating history-writing decisions from state preservation would also need to retain the existing behavior of router.refresh() and back/forward navigation, which should not add history entries.
Acceptance criteria
- A normal visit with
preserveState: trueupdates the destination URL. replace: truereplaces the current entry.router.refresh()and back/forward navigation do not add entries.- Regression coverage checks both state preservation and URL/history behavior.
- Langage dominant
- TypeScript
- Étoiles
- 402
- Forks
- 32
- Merge moyen
- 10 h 51 min
- PR mergées (30 j)
- 100
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de voidzero-dev/void
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
voidzero-dev/void#529 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 1-3 heures Accessibilité débutants 78/100
voidzero-dev/void#428 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 56/100
voidzero-dev/void#527 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 54/100
voidzero-dev/void#525 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 67/100
voidzero-dev/void#524 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de voidzero-dev/void
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 1-3 heures Accessibilité débutants 72/100
zts212653/clowder-ai#1678 ·
Les mainteneurs répondent en général sous 1 jour
-
good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
Progressive-Victory/the-website#680 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100