File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
packages/open-next/src/adapters Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,14 @@ type IncrementalCacheValue =
69
69
| CachedFetchValue
70
70
| CachedRouteValue ;
71
71
72
+ type IncrementalCacheContext = {
73
+ revalidate ?: number | false | undefined ;
74
+ fetchCache ?: boolean | undefined ;
75
+ fetchUrl ?: string | undefined ;
76
+ fetchIdx ?: number | undefined ;
77
+ tags ?: string [ ] | undefined ;
78
+ } ;
79
+
72
80
interface CacheHandlerContext {
73
81
fs ?: never ;
74
82
dev ?: boolean ;
@@ -243,7 +251,11 @@ export default class S3Cache {
243
251
}
244
252
}
245
253
246
- async set ( key : string , data ?: IncrementalCacheValue ) : Promise < void > {
254
+ async set (
255
+ key : string ,
256
+ data ?: IncrementalCacheValue ,
257
+ ctx ?: IncrementalCacheContext ,
258
+ ) : Promise < void > {
247
259
if ( globalThis . disableIncrementalCache ) {
248
260
return ;
249
261
}
@@ -294,7 +306,7 @@ export default class S3Cache {
294
306
// If we use an in house version of getDerivedTags in build we should use it here instead of next's one
295
307
const derivedTags : string [ ] =
296
308
data ?. kind === "FETCH"
297
- ? data . data . tags ?? [ ]
309
+ ? ctx ?. tags ?? data ? .data ? .tags ?? [ ] // before version 14 next.js used data?.data?.tags so we keep it for backward compatibility
298
310
: data ?. kind === "PAGE"
299
311
? data . headers ?. [ "x-next-cache-tags" ] ?. split ( "," ) ?? [ ]
300
312
: [ ] ;
You can’t perform that action at this time.
0 commit comments