Skip to content

Commit 4538f9f

Browse files
authored
fix: revalidate times for fetch entries from context is outdated
fix: revalidate times for fetch entries from context is outdated
2 parents 3c646a0 + e48f0d1 commit 4538f9f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/RedisStringsHandler.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,11 @@ export default class RedisStringsHandler {
466466

467467
// TODO: implement expiration based on cacheControl.expire argument, -> probably relevant for cacheLife and "use cache" etc.: https://nextjs.org/docs/app/api-reference/functions/cacheLife
468468
// Constructing the expire time for the cache entry
469-
const revalidate = ctx.revalidate || ctx.cacheControl?.revalidate;
469+
const revalidate =
470+
// For fetch requests in newest versions, the revalidate context property is never used, and instead the revalidate property of the passed-in data is used
471+
(data.kind === 'FETCH' && data.revalidate) ||
472+
ctx.revalidate ||
473+
ctx.cacheControl?.revalidate;
470474
const expireAt =
471475
revalidate && Number.isSafeInteger(revalidate) && revalidate > 0
472476
? this.estimateExpireAge(revalidate)

0 commit comments

Comments
 (0)