[2.0.1] Internal links do a full page load on a custom scheme (Electron app://)

オープン
#755 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@saudademjj がすでに取り組んでいます。

2026年12月1日 から。

  • #756 @saudademjj による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
20/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
electron, typescript
領域
frontend, web-dev

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
  1. npm install && npm run build && npm start
  2. The window shows a counter of full page loads. It starts at 1.
  3. Click "About".
  4. 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.

主要言語
TypeScript
スター
1.3k
フォーク
193
平均マージ
8時間 48分
マージ済み PR(30日)
21

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

solidjs/solid-router のほかの issue

solidjs/solid-router の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。