Make /about/edit safely pre-render

This commit is contained in:
Sam Becker 2026-03-01 13:33:44 -06:00
parent 915b19bb54
commit bd2dd6a030
2 changed files with 22 additions and 16 deletions

View File

@ -24,7 +24,8 @@ export default async function AboutEditPage() {
photosCount,
photosHidden,
] = await Promise.all([
getAbout().then(async about => {
getAbout()
.then(async about => {
const photoAvatar = about?.photoIdAvatar
? await getPhoto(about?.photoIdAvatar ?? '', true)
.catch(() => undefined)
@ -40,7 +41,12 @@ export default async function AboutEditPage() {
photoAvatar,
photoHero,
};
}),
})
.catch(() => ({
about: undefined,
photoAvatar: undefined,
photoHero: undefined,
})),
getPhotosCached(PHOTO_CHOOSER_QUERY_OPTIONS)
.catch(() => []),
getPhotosMetaCached(PHOTO_CHOOSER_QUERY_OPTIONS)

View File

@ -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}