Stop caching blob upload list commands
This commit is contained in:
parent
8bef969908
commit
611579c886
@ -1,6 +1,6 @@
|
||||
import AdminNav from '@/admin/AdminNav';
|
||||
import {
|
||||
getBlobUploadUrlsCached,
|
||||
getBlobUploadUrlsNoStore,
|
||||
getPhotosCountIncludingHiddenCached,
|
||||
getUniqueTagsCached,
|
||||
} from '@/cache';
|
||||
@ -21,7 +21,7 @@ export default async function AdminLayout({
|
||||
countTags,
|
||||
] = await Promise.all([
|
||||
getPhotosCountIncludingHiddenCached(),
|
||||
getBlobUploadUrlsCached().then(urls => urls.length),
|
||||
getBlobUploadUrlsNoStore().then(urls => urls.length),
|
||||
getUniqueTagsCached().then(tags => tags.length),
|
||||
]);
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import BlobUrls from '@/admin/BlobUrls';
|
||||
import { getBlobUploadUrlsCached } from '@/cache';
|
||||
import { getBlobUploadUrlsNoStore } from '@/cache';
|
||||
import SiteGrid from '@/components/SiteGrid';
|
||||
|
||||
export default async function UploadsPage() {
|
||||
const blobUrls = await getBlobUploadUrlsCached();
|
||||
const blobUrls = await getBlobUploadUrlsNoStore();
|
||||
return (
|
||||
<SiteGrid
|
||||
contentMain={<BlobUrls urls={blobUrls} />}
|
||||
|
||||
20
src/cache/index.ts
vendored
20
src/cache/index.ts
vendored
@ -1,4 +1,9 @@
|
||||
import { revalidatePath, revalidateTag, unstable_cache } from 'next/cache';
|
||||
import {
|
||||
revalidatePath,
|
||||
revalidateTag,
|
||||
unstable_cache,
|
||||
unstable_noStore,
|
||||
} from 'next/cache';
|
||||
import {
|
||||
GetPhotosOptions,
|
||||
getPhoto,
|
||||
@ -253,16 +258,21 @@ export const getUniqueFilmSimulationsCached: typeof getUniqueFilmSimulations = (
|
||||
export const getBlobUploadUrlsCached: typeof getBlobUploadUrls = (...args) =>
|
||||
unstable_cache(
|
||||
() => getBlobUploadUrls(...args),
|
||||
[KEY_BLOB], {
|
||||
tags: [KEY_BLOB],
|
||||
[KEY_BLOB, 'uploads'], {
|
||||
tags: [KEY_BLOB, 'uploads'],
|
||||
}
|
||||
)();
|
||||
|
||||
export const getBlobUploadUrlsNoStore: typeof getBlobUploadUrls = (...args) => {
|
||||
unstable_noStore();
|
||||
return getBlobUploadUrls(...args);
|
||||
};
|
||||
|
||||
export const getBlobPhotoUrlsCached: typeof getBlobPhotoUrls = (...args) =>
|
||||
unstable_cache(
|
||||
() => getBlobPhotoUrls(...args),
|
||||
[KEY_BLOB], {
|
||||
tags: [KEY_BLOB],
|
||||
[KEY_BLOB, 'photos'], {
|
||||
tags: [KEY_BLOB, 'photos'],
|
||||
}
|
||||
)();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user