File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export default class Cache {
6363
6464 const _tags = [ ...( tags ?? [ ] ) , ...( softTags ?? [ ] ) ] ;
6565 const _lastModified = cachedEntry . lastModified ?? Date . now ( ) ;
66- const _hasBeenRevalidated = await hasBeenRevalidated (
66+ const _hasBeenRevalidated = cachedEntry . shouldBypassTagCache ? false : await hasBeenRevalidated (
6767 key ,
6868 _tags ,
6969 cachedEntry ,
@@ -82,7 +82,7 @@ export default class Cache {
8282 ! tag . endsWith ( "page" ) ,
8383 ) ;
8484 if ( path ) {
85- const hasPathBeenUpdated = await hasBeenRevalidated (
85+ const hasPathBeenUpdated = cachedEntry . shouldBypassTagCache ? false : await hasBeenRevalidated (
8686 path . replace ( "_N_T_/" , "" ) ,
8787 [ ] ,
8888 cachedEntry ,
@@ -118,7 +118,7 @@ export default class Cache {
118118 const meta = cacheData . meta ;
119119 const tags = getTagsFromValue ( cacheData ) ;
120120 const _lastModified = cachedEntry . lastModified ?? Date . now ( ) ;
121- const _hasBeenRevalidated = await hasBeenRevalidated (
121+ const _hasBeenRevalidated = cachedEntry . shouldBypassTagCache ? false : await hasBeenRevalidated (
122122 key ,
123123 tags ,
124124 cachedEntry ,
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export default {
2828 globalThis . tagCache . mode === "nextMode" &&
2929 result . value . tags . length > 0
3030 ) {
31- const hasBeenRevalidated = await globalThis . tagCache . hasBeenRevalidated (
31+ const hasBeenRevalidated = result . shouldBypassTagCache ? false : await globalThis . tagCache . hasBeenRevalidated (
3232 result . value . tags ,
3333 result . lastModified ,
3434 ) ;
@@ -37,7 +37,7 @@ export default {
3737 globalThis . tagCache . mode === "original" ||
3838 globalThis . tagCache . mode === undefined
3939 ) {
40- const hasBeenRevalidated =
40+ const hasBeenRevalidated = result . shouldBypassTagCache ? false :
4141 ( await globalThis . tagCache . getLastModified (
4242 cacheKey ,
4343 result . lastModified ,
Original file line number Diff line number Diff line change @@ -93,6 +93,11 @@ export type CachedFetchValue = {
9393export type WithLastModified < T > = {
9494 lastModified ?: number ;
9595 value ?: T ;
96+ /**
97+ * If set to true, we will not check the tag cache for this entry.
98+ * `revalidateTag` and `revalidatePath` may not work as expected.
99+ */
100+ shouldBypassTagCache ?: boolean ;
96101} ;
97102
98103export type CacheEntryType = Extension ;
You can’t perform that action at this time.
0 commit comments