Pages router: API for shallow routing
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Read the implementation of router.visit first and trace what it does in order: the fetch, the route-state update, the history write and the scroll-restoration bookkeeping. Compare that with the raw history.replaceState fallback described here, which leaves useRouter().url and .query stale, and identify where route state is derived so a shallow variant can update it without fetching. Done means router.visit(url, { replace: true, shallow: true }) changes history and router state while no request runs and deferred props are untouched, with a test covering the no-fetch guarantee.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Void version: 1.9.1, affecting every adapter
Use case
The simplest that I hit: A page has multiple side panels with info. Which panel is open depends on the query string (/page?panel=X), so the view can be shared and other pages can link to it.
The server ignores the param: it's left out of revalidateQueryAllowlist, so every variant shares one ISR entry, and the panel opens on the client.
When the user opens, switches or closes a panel, ?panel= should change in place: no new history entry, no request, no re-render.
Current status with today's API
The only Void way to change the query is
router.visit(url, { replace: true, preserveState: true, preserveScroll: true });
which is a full GET navigation. For state the server doesn't render, that means:
- The page data is fetched again on every change, in our case that's about 122 KB except the exact entry was cached already.
- Deferred props go back to loading, which would include our panel.
So instead of using it we fall back to the raw history.replaceState. That works, but the router no longer matches the address bar: useRouter().url / .query keep reporting the old query until the next navigation.
API Proposal
Something like
router.replaceUrl(url); // or router.visit(url, { replace: true, shallow: true })
This would:
- write history (replace, or push as an option),
- update the router's route state
- keep scroll-restoration bookkeeping in step,
- does not fetch, re-render, or touch deferred props.
This is similar to what other meta frameworks do, e.g. SvelteKit's replaceState or Next.js's shallow routing.
- Ngôn ngữ chính
- TypeScript
- Star
- 684
- Fork
- 83
- Merge trung bình
- 15 giờ 22 phút
- Pull request đã merge (30 ngày)
- 219
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/void
-
`void platform install --app-access public` fails when Cloudflare reports Access is disabledĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/void#835 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
voidzero-dev/void#834 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
voidzero-dev/void#832 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
voidzero-dev/void#825 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
voidzero-dev/void#808 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của voidzero-dev/void
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
open-webui/tether#52 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
AykutSarac/jsoncrack.com#616 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
melgarafael/DeskcommCRM#4679 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement size:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày