Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Pages: preserveState prevents the destination URL from being committed

オープン
#506 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript, vite

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

  1. Start on /case.
  2. Navigate using:
await router.visit('/settings', {
  preserveState: true,
});
  1. Return a valid Pages response for /settings.
  2. 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: true updates the destination URL.
  • replace: true replaces the current entry.
  • router.refresh() and back/forward navigation do not add entries.
  • Regression coverage checks both state preservation and URL/history behavior.
主要言語
TypeScript
スター
402
フォーク
32
平均マージ
11時間 52分
マージ済み PR(30日)
88

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

voidzero-dev/void のほかの issue

voidzero-dev/void の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。