[2.0.1] Internal links do a full page load on a custom scheme (Electron app://)
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 20/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- electron, typescript
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1.3k
- Forks
- 193
- Ø Merge
- 8 Std. 48 Min.
- Gemergte PRs (30 T.)
- 21
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus solidjs/solid-router
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
solidjs/solid-router#757 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[2.0.1] diagnostics: a request for // crashes the dev server (Invalid URL in describeInitial)Evtl. vergeben @bryanlundberg hat das vor 4 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
solidjs/solid-router#752 ·
Maintainer antworten meist innerhalb von 1 Tag
-
liveQuery SSR: the producer of a `live()` server function is never finalized after the response ends (the `return()` queues behind a read-ahead `next()`)Evtl. vergeben @clean99 hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
solidjs/solid-router#751 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[2.0.1] hashHistory: link claims and useLinkState ignore the hash, so aria-current/data-active are wrong on every linkEvtl. vergeben @clean99 hat das vor 10 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
solidjs/solid-router#746 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
solidjs/solid-router#736 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in solidjs/solid-router
Ähnliche Issues
-
blocklist addition
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
MetaMask/eth-phishing-detect#319194 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
continuedev/continue#13533 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 6 Tagen
-
bug codex:automation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
genfeedai/genfeed.ai#12060 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bounty good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
fitzss/valun-open#15 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag