Skip to content

Commit 4eef3a7

Browse files
committed
review fix
1 parent a08a093 commit 4eef3a7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/open-next/src/adapters/cache.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ export default class Cache {
113113
return null;
114114
}
115115

116-
const cacheData = cachedEntry?.value;
116+
const cacheData = cachedEntry.value;
117117

118-
const meta = cacheData?.meta;
118+
const meta = cacheData.meta;
119119
const tags = getTagsFromValue(cacheData);
120120
const _lastModified = cachedEntry.lastModified ?? Date.now();
121121
const _hasBeenRevalidated = await hasBeenRevalidated(
122122
key,
123123
tags,
124124
cachedEntry,
125125
);
126-
if (cacheData === undefined || _hasBeenRevalidated) return null;
126+
if (_hasBeenRevalidated) return null;
127127

128128
const store = globalThis.__openNextAls.getStore();
129129
if (store) {
@@ -400,18 +400,21 @@ export default class Cache {
400400
}
401401
}
402402

403+
// TODO: We should delete/update tags in this method
404+
// This will require an update to the tag cache interface
403405
private async updateTagsOnSet(
404406
key: string,
405407
data?: IncrementalCacheValue,
406408
ctx?: IncrementalCacheContext,
407409
) {
408410
if (
409411
globalThis.openNextConfig.dangerous?.disableTagCache ||
410-
globalThis.tagCache.mode === "nextMode"
412+
globalThis.tagCache.mode === "nextMode" ||
413+
// Here it means it's a delete
414+
!data
411415
) {
412416
return;
413417
}
414-
415418
// Write derivedTags to the tag cache
416419
// If we use an in house version of getDerivedTags in build we should use it here instead of next's one
417420
const derivedTags: string[] =

0 commit comments

Comments
 (0)