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 {
6666 const _hasBeenRevalidated = await hasBeenRevalidated (
6767 key ,
6868 _tags ,
69- cachedEntry ?. lastModified ,
69+ cachedEntry ,
7070 ) ;
7171
7272 if ( _hasBeenRevalidated ) return null ;
@@ -85,7 +85,7 @@ export default class Cache {
8585 const hasPathBeenUpdated = await hasBeenRevalidated (
8686 path . replace ( "_N_T_/" , "" ) ,
8787 [ ] ,
88- cachedEntry . lastModified ,
88+ cachedEntry ,
8989 ) ;
9090 if ( hasPathBeenUpdated ) {
9191 // In case the path has been revalidated, we don't want to use the fetch cache
@@ -121,7 +121,7 @@ export default class Cache {
121121 const _hasBeenRevalidated = await hasBeenRevalidated (
122122 key ,
123123 tags ,
124- _lastModified ,
124+ cachedEntry ,
125125 ) ;
126126 if ( cacheData === undefined || _hasBeenRevalidated ) return null ;
127127
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ export async function cacheInterceptor(
168168 const _hasBeenRevalidated = await hasBeenRevalidated (
169169 localizedPath ,
170170 tags ,
171- cachedData . lastModified ,
171+ cachedData ,
172172 ) ;
173173 if ( _hasBeenRevalidated ) {
174174 return event ;
Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ export type TagCacheMetaFile = {
9797 path : { S : string } ;
9898 revalidatedAt : { N : string } ;
9999} ;
100+
100101export type IncrementalCacheContext = {
101102 revalidate ?: number | false | undefined ;
102103 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" ;
22
33export async function hasBeenRevalidated (
44 key : string ,
55 tags : string [ ] ,
6- lastModified ?: number ,
6+ cacheEntry : WithLastModified < CacheValue < any > > ,
77) : Promise < boolean > {
88 if ( globalThis . openNextConfig . dangerous ?. disableTagCache ) {
99 return false ;
1010 }
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 ( ) ;
1120 if ( globalThis . tagCache . mode === "nextMode" ) {
1221 return await globalThis . tagCache . hasBeenRevalidated ( tags , lastModified ) ;
1322 }
You can’t perform that action at this time.
0 commit comments