Skip to content

Commit 14b47aa

Browse files
committed
fix(qwik-city): don't redirect to captive portals when prefetching
1 parent bc457c2 commit 14b47aa

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/shaky-parks-hope.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@builder.io/qwik-city': patch
3+
---
4+
5+
fix: while prefetching Link data, don't navigate to captive portals

packages/qwik-city/src/runtime/src/use-endpoint.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ export const loadClientData = async (
3737
const redirectedURL = new URL(rsp.url);
3838
const isQData = redirectedURL.pathname.endsWith('/q-data.json');
3939
if (!isQData || redirectedURL.origin !== location.origin) {
40-
// Captive portal etc. We can't talk to the server, so redirect as asked
41-
location.href = redirectedURL.href;
40+
// Captive portal etc. We can't talk to the server, so redirect as asked, except when prefetching
41+
if (!opts?.isPrefetch) {
42+
location.href = redirectedURL.href;
43+
}
4244
return;
4345
}
4446
}

0 commit comments

Comments
 (0)