[2.0.1] Internal links do a full page load on a custom scheme (Electron app://)
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 20/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- electron, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.3k
- Forks
- 193
- Merge medio
- 8 h 48 min
- PR fusionados (30 d)
- 21
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de solidjs/solid-router
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
solidjs/solid-router#757 ·
Los mantenedores suelen responder en 1 día
-
[2.0.1] diagnostics: a request for // crashes the dev server (Invalid URL in describeInitial)Posiblemente ocupada @bryanlundberg la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
solidjs/solid-router#752 ·
Los mantenedores suelen responder en 1 día
-
liveQuery SSR: the producer of a `live()` server function is never finalized after the response ends (the `return()` queues behind a read-ahead `next()`)Posiblemente ocupada @clean99 la tomó hace 2 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
solidjs/solid-router#751 ·
Los mantenedores suelen responder en 1 día
-
[2.0.1] hashHistory: link claims and useLinkState ignore the hash, so aria-current/data-active are wrong on every linkPosiblemente ocupada @clean99 la tomó hace 9 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
solidjs/solid-router#746 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
solidjs/solid-router#736 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de solidjs/solid-router
Issues similares
-
area:api bug good first issue priority:high
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Doezer/Questarr#1486 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area:import difficulty:good-first good first issue help wanted priority:P1 roadmap size:S type:test
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Sergey-Bar/Penny#245 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
mihazs/lazysh#3377 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Approve the Cloudflare agent plugin for harness sessionsPosiblemente ocupada @joshtsch la tomó hoy. Abiertoenhancement ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día