Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 2230388

Browse files
authored
Allow setting revalidate to 0
This makes useDeno always refresh on each request. It was also possible to pass a small value, e.g., `0.0000001`, but this is less hackish.
1 parent 3014f4f commit 2230388

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

framework/react/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function useDeno<T = any>(callback: () => (T | Promise<T>), revalidate?:
4040
const dataUrl = 'pagedata://' + pathname
4141
const eventName = 'useDeno-' + dataUrl
4242
const key = dataUrl + '#' + id
43-
const expires = revalidate ? Date.now() + revalidate * 1000 : 0
43+
const expires = typeof revalidate === 'number' ? Date.now() + revalidate * 1000 : 0
4444
const renderingDataCache = global['rendering-' + dataUrl]
4545
if (renderingDataCache && key in renderingDataCache) {
4646
return renderingDataCache[key] // 2+ pass

0 commit comments

Comments
 (0)