From 813a856e2403bfa2649a6e4d9168ecec550fa654 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Fri, 16 Jan 2026 18:16:52 +0100 Subject: [PATCH] silence window-scope error --- src/lib/utils/network_detection.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/utils/network_detection.ts b/src/lib/utils/network_detection.ts index c1821b8..5358441 100644 --- a/src/lib/utils/network_detection.ts +++ b/src/lib/utils/network_detection.ts @@ -25,8 +25,9 @@ const NETWORK_ENDPOINTS = [ export async function isNetworkOnline(): Promise { for (const endpoint of NETWORK_ENDPOINTS) { try { - // Use a simple fetch without HEAD method to avoid CORS issues - await fetch(endpoint, { + // Use window.fetch explicitly for client-side network detection + // This is intentionally client-side code, not a SvelteKit load function + await window.fetch(endpoint, { method: "GET", cache: "no-cache", signal: AbortSignal.timeout(3000), @@ -56,7 +57,9 @@ export async function testNetworkSpeed(): Promise { for (const endpoint of NETWORK_ENDPOINTS) { try { - await fetch(endpoint, { + // Use window.fetch explicitly for client-side network detection + // This is intentionally client-side code, not a SvelteKit load function + await window.fetch(endpoint, { method: "GET", cache: "no-cache", signal: AbortSignal.timeout(5000),