List photo urls with noStore

This commit is contained in:
Sam Becker 2023-11-10 22:25:33 -06:00
parent 915b71297c
commit 5f99e46cbe
2 changed files with 7 additions and 2 deletions

View File

@ -14,7 +14,7 @@ import {
import { titleForPhoto } from '@/photo'; import { titleForPhoto } from '@/photo';
import MorePhotos from '@/photo/MorePhotos'; import MorePhotos from '@/photo/MorePhotos';
import { import {
getBlobPhotoUrlsCached, getBlobPhotoUrlsNoStore,
getPhotosCached, getPhotosCached,
getPhotosCountIncludingHiddenCached, getPhotosCountIncludingHiddenCached,
} from '@/cache'; } from '@/cache';
@ -45,7 +45,7 @@ export default async function AdminTagsPage({
] = await Promise.all([ ] = await Promise.all([
getPhotosCached({ includeHidden: true, sortBy: 'createdAt', limit }), getPhotosCached({ includeHidden: true, sortBy: 'createdAt', limit }),
getPhotosCountIncludingHiddenCached(), getPhotosCountIncludingHiddenCached(),
DEBUG_PHOTO_BLOBS ? getBlobPhotoUrlsCached() : [], DEBUG_PHOTO_BLOBS ? getBlobPhotoUrlsNoStore() : [],
]); ]);
const showMorePhotos = count > photos.length; const showMorePhotos = count > photos.length;

5
src/cache/index.ts vendored
View File

@ -276,6 +276,11 @@ export const getBlobPhotoUrlsCached: typeof getBlobPhotoUrls = (...args) =>
} }
)(); )();
export const getBlobPhotoUrlsNoStore: typeof getBlobPhotoUrls = (...args) => {
unstable_noStore();
return getBlobPhotoUrls(...args);
};
export const getImageCacheHeadersForAuth = (session: Session | null) => { export const getImageCacheHeadersForAuth = (session: Session | null) => {
return { return {
'Cache-Control': !session?.user 'Cache-Control': !session?.user