From 95ac371212272956fb396c7e29b198fe2854525c Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Mon, 23 Oct 2023 08:31:02 -0500 Subject: [PATCH] Add temporary key to tag/camera queries --- src/cache/index.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cache/index.ts b/src/cache/index.ts index a34a2a98..282baf77 100644 --- a/src/cache/index.ts +++ b/src/cache/index.ts @@ -25,6 +25,8 @@ const KEY_PHOTOS_DATE_RANGE = `${KEY_PHOTOS}-date-range`; const KEY_TAGS = 'tags'; const KEY_CAMERAS = 'cameras'; const KEY_BLOB = 'blob'; +// Temporary key to clear caches on forked blogs +const KEY_NEW_QUERY = 'new-query'; // eslint-disable-next-line max-len const getPhotosCacheKeyForOption = ( @@ -186,8 +188,8 @@ export const getPhotoCached: typeof getPhoto = (...args) => export const getUniqueTagsCached: typeof getUniqueTags = (...args) => unstable_cache( () => getUniqueTags(...args), - [KEY_PHOTOS, KEY_TAGS], { - tags: [KEY_PHOTOS, KEY_TAGS], + [KEY_PHOTOS, KEY_TAGS, KEY_NEW_QUERY], { + tags: [KEY_PHOTOS, KEY_TAGS, KEY_NEW_QUERY], } )(); @@ -195,16 +197,16 @@ export const getUniqueTagsCached: typeof getUniqueTags = (...args) => export const getUniqueTagsHiddenCached: typeof getUniqueTagsHidden = (...args) => unstable_cache( () => getUniqueTagsHidden(...args), - [KEY_PHOTOS, KEY_TAGS], { - tags: [KEY_PHOTOS, KEY_TAGS], + [KEY_PHOTOS, KEY_TAGS, KEY_NEW_QUERY], { + tags: [KEY_PHOTOS, KEY_TAGS, KEY_NEW_QUERY], } )(); export const getUniqueCamerasCached: typeof getUniqueCameras = (...args) => unstable_cache( () => getUniqueCameras(...args), - [KEY_PHOTOS, KEY_CAMERAS], { - tags: [KEY_PHOTOS, KEY_CAMERAS], + [KEY_PHOTOS, KEY_CAMERAS, KEY_NEW_QUERY], { + tags: [KEY_PHOTOS, KEY_CAMERAS, KEY_NEW_QUERY], } )();