Skip to content

Commit 97184e4

Browse files
committed
more lenient on cache resuming (allow nested promises during hydration)
1 parent 1c9eb8e commit 97184e4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.changeset/witty-garlics-press.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/router": patch
3+
---
4+
5+
more lenient on cache resuming (allow nested promises during hydration)

src/data/query.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ export function query<T extends (...args: any) => any>(fn: T, name: string): Cac
128128
inPreloadFn && "then" in res && res.catch(() => {});
129129
return res;
130130
}
131-
let res =
132-
!isServer && sharedConfig.context && sharedConfig.has!(key)
133-
? sharedConfig.load!(key) // hydrating
134-
: fn(...(args as any));
131+
let res;
132+
if (!isServer && sharedConfig.has && sharedConfig.has(key)) {
133+
res = sharedConfig.load!(key) // hydrating
134+
// @ts-ignore at least until we add a delete method to sharedConfig
135+
delete globalThis._$HY.r[key];
136+
} else res = fn(...(args as any));
135137

136138
if (cached) {
137139
cached[0] = now;

0 commit comments

Comments
 (0)