P2b: Relative URL Resolution in instrumented fetch — baseUrl live von location.href #82

Closed
opened 2026-06-18 17:17:56 +00:00 by Artur · 1 comment
Owner

P2b: Relative URL Resolution in instrumented fetch

Priority: MEDIUM
Betrifft: qwik.dev (Lazy-Loading), ALLE Seiten mit fetch("/assets/...")
Aufwand: ~2h

Problembeschreibung

Qwik's Lazy-Loading-Module machen fetch("/assets/some-bundle.js").
Die instrumentierte fetch() in createFetch() resolved relative URLs nur gegen
den baseUrl der zum Zeitpunkt des createFetch-Aufrufs gültig war.

Wenn die Seite nach-navigiert (z.B. SPA-Routing), ist baseUrl veraltet.

Aktuell:

// fetch.ts — baseUrl ist ein statischer Wert oder Getter
const base = typeof config.baseUrl === 'function' ? config.baseUrl() : (config.baseUrl ?? "http://localhost/");

Problem: config.baseUrl wird beim createFetch-Aufruf einmalig gespeichert.
Qwik's dynamische fetch()-Aufrufe nutzen window.fetch() — das ist UNSERE
instrumentierte Variante, aber baseUrl ist noch der initiale Wert.

Option A: Live-Resolution via window.location.href

// In createFetch(): base immer live von window.location.href lesen
const baseUrl = typeof window !== 'undefined' && window.location
  ? window.location.href
  : 'http://localhost/';

Akzeptanzkriterien

  • Qwik.dev lädt Lazy-Loading-Bundles ohne Invalid URL Error
  • fetch("/absolute/path") wird gegen korrekte base resolved
  • SPA-Navigation aktualisiert base live

Betroffene Dateien

Datei Änderung
src/network/fetch.ts baseUrl-Resolution live von window.location
src/js/script-loader.ts fetchAndExecuteAsync relative URL resolution
tests/unit/sprint18-relative-url.test.ts 3+ Tests
## P2b: Relative URL Resolution in instrumented fetch **Priority:** MEDIUM **Betrifft:** qwik.dev (Lazy-Loading), ALLE Seiten mit `fetch("/assets/...")` **Aufwand:** ~2h ### Problembeschreibung Qwik's Lazy-Loading-Module machen `fetch("/assets/some-bundle.js")`. Die instrumentierte `fetch()` in `createFetch()` resolved relative URLs nur gegen den `baseUrl` der zum Zeitpunkt des `createFetch`-Aufrufs gültig war. Wenn die Seite nach-navigiert (z.B. SPA-Routing), ist `baseUrl` veraltet. **Aktuell:** ```typescript // fetch.ts — baseUrl ist ein statischer Wert oder Getter const base = typeof config.baseUrl === 'function' ? config.baseUrl() : (config.baseUrl ?? "http://localhost/"); ``` **Problem:** `config.baseUrl` wird beim `createFetch`-Aufruf einmalig gespeichert. Qwik's dynamische `fetch()`-Aufrufe nutzen `window.fetch()` — das ist UNSERE instrumentierte Variante, aber `baseUrl` ist noch der initiale Wert. ### Option A: Live-Resolution via window.location.href ```typescript // In createFetch(): base immer live von window.location.href lesen const baseUrl = typeof window !== 'undefined' && window.location ? window.location.href : 'http://localhost/'; ``` ### Akzeptanzkriterien - [ ] Qwik.dev lädt Lazy-Loading-Bundles ohne Invalid URL Error - [ ] `fetch("/absolute/path")` wird gegen korrekte base resolved - [ ] SPA-Navigation aktualisiert base live ### Betroffene Dateien | Datei | Änderung | |-------|----------| | `src/network/fetch.ts` | baseUrl-Resolution live von window.location | | `src/js/script-loader.ts` | fetchAndExecuteAsync relative URL resolution | | `tests/unit/sprint18-relative-url.test.ts` | 3+ Tests |
Artur closed this issue 2026-06-18 17:27:09 +00:00
Author
Owner

Nicht implementiert — Relative URL Resolution

Problem: Qwik's Lazy-Loading macht import("./assets/foo.js") oder fetch("/assets/foo.json").
Die instrumentierte fetch() resolved relative URLs gegen config.baseUrl, der beim
createFetch-Aufruf gesetzt wurde. Nach SPA-Navigation ist dieser veraltet.

Benötigt: baseUrl live von window.location.href lesen statt statisch speichern.

Aufwandsabschätzung: ~2h

❌ **Nicht implementiert** — Relative URL Resolution **Problem:** Qwik's Lazy-Loading macht `import("./assets/foo.js")` oder `fetch("/assets/foo.json")`. Die instrumentierte `fetch()` resolved relative URLs gegen `config.baseUrl`, der beim `createFetch`-Aufruf gesetzt wurde. Nach SPA-Navigation ist dieser veraltet. **Benötigt:** `baseUrl` live von `window.location.href` lesen statt statisch speichern. **Aufwandsabschätzung:** ~2h
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
glow-all/true-headless-browser#82
No description provided.