mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Fix passing revalidateBefore option when calling cacheResponse to ensure these go through background revalidation (#2342)
This commit is contained in:
Vendored
+1
-1
@@ -202,7 +202,7 @@ export function cache<Args extends any[], Result>(
|
||||
|
||||
if (savedEntry.meta.revalidatesAt && savedEntry.meta.revalidatesAt < Date.now()) {
|
||||
// Revalidate in the background
|
||||
waitUntil(revalidate(key, undefined, ...args));
|
||||
await waitUntil(revalidate(key, undefined, ...args));
|
||||
}
|
||||
|
||||
return savedEntry.data;
|
||||
|
||||
Vendored
+1
@@ -50,6 +50,7 @@ export function cacheResponse<Result, DefaultData = Result>(
|
||||
return {
|
||||
ttl: defaultEntry.ttl ?? parsed.ttl,
|
||||
tags: [...(defaultEntry.tags ?? []), ...parsed.tags],
|
||||
revalidateBefore: defaultEntry.revalidateBefore,
|
||||
// @ts-ignore
|
||||
data: defaultEntry.data ?? response.data,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user