[2.0.1] Internal links do a full page load on a custom scheme (Electron app://)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 20/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- electron, typescript
Hướng nghiên cứu
Start in src/data/events.ts at anchorUrl and review the protocol and origin checks described in the issue. Reproduce with the linked custom-scheme example and compare its behavior with npm run preview. The issue reports a fix and an open linked pull request (#756); the expected result is client-side navigation without incrementing the page-load counter.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
In an Electron app that serves its build from a custom scheme (app://example/ via protocol.handle), every click on an internal link does a full page load instead of client-side navigation.
Looks like it comes from the check added in #581 (for #382) in anchorUrl, src/data/events.ts:
if (url.protocol !== "https:" && url.protocol !== "http:") return;
if (url.origin !== window.location.origin || !isUnderBase(url.pathname, basePath)) return;
On an app:// page every link has url.protocol === "app:", so the router never handles it and the browser just navigates. The origin check below would actually pass: with app registered as a standard scheme, new URL("/about", document.baseURI).origin and location.origin are both app://example.
Same check is on 1.x too (went out in v1.0.1).
Your Example Website or App
https://github.com/devunt/solid-router-custom-scheme-repro
Steps to Reproduce the Bug or Issue
npm install && npm run build && npm start- The window shows a counter of full page loads. It starts at 1.
- Click "About".
- The counter goes to 2, so the page was reloaded.
With npm run preview (same build over http) the counter stays at 1.
Expected behavior
Clicking "About" navigates on the client like it does over http, and the counter stays at 1.
Screenshots or Videos
No response
Platform
- OS: Linux
- Browser: Electron 45.5.0 (Chromium 156)
- Version: @solidjs/router 2.0.1
Additional context
Allowing the page's own scheme fixes it for me and still skips blob:/mailto:/tel:/data: links, since those never match the page's scheme:
- if (url.protocol !== "https:" && url.protocol !== "http:") return;
+ if (url.protocol !== "https:" && url.protocol !== "http:" && url.protocol !== window.location.protocol) return;
I'm running 2.0.1 with this patched in and the counter in the repro stays at 1.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.3k
- Fork
- 193
- Merge trung bình
- 8 giờ 48 phút
- Pull request đã merge (30 ngày)
- 21
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 solidjs/solid-router
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
solidjs/solid-router#757 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[2.0.1] diagnostics: a request for // crashes the dev server (Invalid URL in describeInitial)Có thể đã có người làm @bryanlundberg đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
solidjs/solid-router#752 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
liveQuery SSR: the producer of a `live()` server function is never finalized after the response ends (the `return()` queues behind a read-ahead `next()`)Có thể đã có người làm @clean99 đã nhận 2 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
solidjs/solid-router#751 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[2.0.1] hashHistory: link claims and useLinkState ignore the hash, so aria-current/data-active are wrong on every linkCó thể đã có người làm @clean99 đã nhận 9 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
solidjs/solid-router#746 ·
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 48/100
solidjs/solid-router#736 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs/solid-router
Issue tương tự
-
area:api bug good first issue priority:high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Doezer/Questarr#1486 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:import difficulty:good-first good first issue help wanted priority:P1 roadmap size:S type:test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Sergey-Bar/Penny#245 ·
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 78/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 68/100
mihazs/lazysh#3377 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Approve the Cloudflare agent plugin for harness sessionsCó thể đã có người làm @joshtsch đã nhận hôm nay. Đang mởenhancement ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày