File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export default class Cache {
66
66
const _hasBeenRevalidated = await hasBeenRevalidated (
67
67
key ,
68
68
_tags ,
69
- cachedEntry ?. lastModified ,
69
+ cachedEntry ,
70
70
) ;
71
71
72
72
if ( _hasBeenRevalidated ) return null ;
@@ -85,7 +85,7 @@ export default class Cache {
85
85
const hasPathBeenUpdated = await hasBeenRevalidated (
86
86
path . replace ( "_N_T_/" , "" ) ,
87
87
[ ] ,
88
- cachedEntry . lastModified ,
88
+ cachedEntry ,
89
89
) ;
90
90
if ( hasPathBeenUpdated ) {
91
91
// In case the path has been revalidated, we don't want to use the fetch cache
@@ -121,7 +121,7 @@ export default class Cache {
121
121
const _hasBeenRevalidated = await hasBeenRevalidated (
122
122
key ,
123
123
tags ,
124
- _lastModified ,
124
+ cachedEntry ,
125
125
) ;
126
126
if ( cacheData === undefined || _hasBeenRevalidated ) return null ;
127
127
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ export async function cacheInterceptor(
168
168
const _hasBeenRevalidated = await hasBeenRevalidated (
169
169
localizedPath ,
170
170
tags ,
171
- cachedData . lastModified ,
171
+ cachedData ,
172
172
) ;
173
173
if ( _hasBeenRevalidated ) {
174
174
return event ;
Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ export type TagCacheMetaFile = {
97
97
path : { S : string } ;
98
98
revalidatedAt : { N : string } ;
99
99
} ;
100
+
100
101
export type IncrementalCacheContext = {
101
102
revalidate ?: number | false | undefined ;
102
103
fetchCache ?: boolean | undefined ;
Original file line number Diff line number Diff line change 1
- import type { CacheValue } from "types/overrides" ;
1
+ import type { CacheValue , WithLastModified } from "types/overrides" ;
2
2
3
3
export async function hasBeenRevalidated (
4
4
key : string ,
5
5
tags : string [ ] ,
6
- lastModified ?: number ,
6
+ cacheEntry : WithLastModified < CacheValue < any > > ,
7
7
) : Promise < boolean > {
8
8
if ( globalThis . openNextConfig . dangerous ?. disableTagCache ) {
9
9
return false ;
10
10
}
11
+ const value = cacheEntry . value ;
12
+ if ( ! value ) {
13
+ // We should never reach this point
14
+ return true ;
15
+ }
16
+ if ( "type" in cacheEntry && cacheEntry . type === "page" ) {
17
+ return false ;
18
+ }
19
+ const lastModified = cacheEntry . lastModified ?? Date . now ( ) ;
11
20
if ( globalThis . tagCache . mode === "nextMode" ) {
12
21
return await globalThis . tagCache . hasBeenRevalidated ( tags , lastModified ) ;
13
22
}
You can’t perform that action at this time.
0 commit comments