Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit 244d191

Browse files
committed
間違えた
1 parent 20ed8bf commit 244d191

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/sw/src/sw.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ async function respondToNavigation(request: Request): Promise<Response> {
2222

2323
try {
2424
const response = await fetch(request, { signal: controller.signal });
25-
globalThis.clearTimeout(timeout);
26-
// Return the response as-is, preserving legitimate error status codes
27-
return response;
25+
26+
if (response?.status && response.status < 500) return response;
27+
if (response?.type === 'opaqueredirect') return response;
2828
} catch (error) {
29-
globalThis.clearTimeout(timeout);
3029
if (_DEV_) {
3130
console.warn('navigation fetch failed; showing offline page', error);
3231
}
32+
} finally {
33+
globalThis.clearTimeout(timeout);
3334
}
3435

3536
// Only show offline page when network request actually fails

0 commit comments

Comments
 (0)