Prevent /tags/hidden pre-rendering

This commit is contained in:
Sam Becker 2024-05-15 12:41:07 -05:00
parent 34c7ad87f1
commit a3a17d8835
2 changed files with 11 additions and 4 deletions

View File

@ -2,17 +2,18 @@ import AnimateItems from '@/components/AnimateItems';
import Banner from '@/components/Banner';
import SiteGrid from '@/components/SiteGrid';
import PhotoGrid from '@/photo/PhotoGrid';
import { getPhotosCached, getPhotosTagHiddenMetaCached } from '@/photo/cache';
import { getPhotosNoStore } from '@/photo/cache';
import { getPhotosTagHiddenMeta } from '@/photo/db';
import { absolutePathForTag } from '@/site/paths';
import { TAG_HIDDEN, descriptionForTaggedPhotos, titleForTag } from '@/tag';
import HiddenHeader from '@/tag/HiddenHeader';
import { Metadata } from 'next';
import { cache } from 'react';
const getPhotosTagHiddenMetaCachedCached = cache(getPhotosTagHiddenMetaCached);
const getPhotosTagHiddenMetaCached = cache(getPhotosTagHiddenMeta);
export async function generateMetadata(): Promise<Metadata> {
const { count, dateRange } = await getPhotosTagHiddenMetaCachedCached();
const { count, dateRange } = await getPhotosTagHiddenMetaCached();
if (count === 0) { return {}; }
@ -45,9 +46,10 @@ export default async function HiddenTagPage() {
photos,
{ count, dateRange },
] = await Promise.all([
getPhotosCached({ hidden: 'only' }),
getPhotosNoStore({ hidden: 'only' }),
getPhotosTagHiddenMetaCached(),
]);
return (
<SiteGrid
contentMain={<div className="space-y-4 mt-4">

View File

@ -230,6 +230,11 @@ export const getUniqueFilmSimulationsCached =
// No store
export const getPhotosNoStore = (...args: Parameters<typeof getPhotos>) => {
unstable_noStore();
return getPhotos(...args);
};
export const getPhotoNoStore = (...args: Parameters<typeof getPhoto>) => {
unstable_noStore();
return getPhoto(...args);