Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#527 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
56/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript, vite
Lĩnh vực
frontend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
TypeScript
Star
402
Fork
32
Merge trung bình
10 giờ 51 phút
Pull request đã merge (30 ngày)
100

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của voidzero-dev/void

Tất cả issue của voidzero-dev/void

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.