Skip to content

Commit fab3cc0

Browse files
committedFeb 1, 2024
fix renderToString for cache fns
1 parent 1953883 commit fab3cc0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
 

‎.changeset/three-chicken-juggle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/router": patch
3+
---
4+
5+
fix renderToString for cache fns

‎src/data/cache.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,17 @@ export function cache<T extends (...args: any) => U | Response, U>(
106106
return res;
107107
}
108108
let res =
109-
!isServer && sharedConfig.context && sharedConfig.load
110-
? sharedConfig.load(key) // hydrating
109+
!isServer && sharedConfig.context && sharedConfig.has!(key)
110+
? sharedConfig.load!(key) // hydrating
111111
: fn(...(args as any));
112112

113113
// serialize on server
114-
if (isServer && sharedConfig.context && !(sharedConfig.context as any).noHydrate) {
114+
if (
115+
isServer &&
116+
sharedConfig.context &&
117+
(sharedConfig.context as any).async &&
118+
!(sharedConfig.context as any).noHydrate
119+
) {
115120
const e = getRequestEvent();
116121
(!e || !e.serverOnly) && (sharedConfig.context as any).serialize(key, res);
117122
}

0 commit comments

Comments
 (0)
Please sign in to comment.