From bd2dd6a03084fdf1c89f3729847559379ed5d67f Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 1 Mar 2026 13:33:44 -0600 Subject: [PATCH] Make /about/edit safely pre-render --- app/about/edit/page.tsx | 36 +++++++++++++++++++------------- src/about/AdminAboutEditPage.tsx | 2 +- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/about/edit/page.tsx b/app/about/edit/page.tsx index 212ace2b..a0d1e9c2 100644 --- a/app/about/edit/page.tsx +++ b/app/about/edit/page.tsx @@ -24,23 +24,29 @@ export default async function AboutEditPage() { photosCount, photosHidden, ] = await Promise.all([ - getAbout().then(async about => { - const photoAvatar = about?.photoIdAvatar - ? await getPhoto(about?.photoIdAvatar ?? '', true) - .catch(() => undefined) - : undefined; + getAbout() + .then(async about => { + const photoAvatar = about?.photoIdAvatar + ? await getPhoto(about?.photoIdAvatar ?? '', true) + .catch(() => undefined) + : undefined; - const photoHero = about?.photoIdHero - ? await getPhoto(about?.photoIdHero ?? '', true) - .catch(() => undefined) - : undefined; + const photoHero = about?.photoIdHero + ? await getPhoto(about?.photoIdHero ?? '', true) + .catch(() => undefined) + : undefined; - return { - about, - photoAvatar, - photoHero, - }; - }), + return { + about, + photoAvatar, + photoHero, + }; + }) + .catch(() => ({ + about: undefined, + photoAvatar: undefined, + photoHero: undefined, + })), getPhotosCached(PHOTO_CHOOSER_QUERY_OPTIONS) .catch(() => []), getPhotosMetaCached(PHOTO_CHOOSER_QUERY_OPTIONS) diff --git a/src/about/AdminAboutEditPage.tsx b/src/about/AdminAboutEditPage.tsx index ef54fba3..eded8785 100644 --- a/src/about/AdminAboutEditPage.tsx +++ b/src/about/AdminAboutEditPage.tsx @@ -67,7 +67,7 @@ export default function AdminAboutEditPage({ label="Avatar Photo" value={aboutForm?.photoIdAvatar ?? ''} onChange={photoIdAvatar => setAboutForm(form => - ({ ...form, photoIdAvatar: convertUrlToPhotoId(photoIdAvatar) }))} + ({ ...form, photoIdAvatar }))} photo={photoAvatar} photos={photos} photosCount={photosCount}