Fix image OG grid crash when photo URLs are missing
Guard the OG photo grid against empty URL results so prerendering does not crash when an optimized image fetch fails. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a11560b437
commit
711a44265c
@ -59,11 +59,21 @@ export default async function ImagePhotoGrid({
|
||||
IS_PREVIEW,
|
||||
);
|
||||
|
||||
if (count === 0 || photoUrls.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const renderPhoto = (
|
||||
{ id, urlData }: typeof photoUrls[number],
|
||||
photo: (typeof photoUrls)[number] | undefined,
|
||||
width: number,
|
||||
height: number,
|
||||
) =>
|
||||
) => {
|
||||
if (!photo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { id, urlData } = photo;
|
||||
return (
|
||||
<div
|
||||
key={id}
|
||||
style={{
|
||||
@ -85,7 +95,9 @@ export default async function ImagePhotoGrid({
|
||||
objectFit: 'cover',
|
||||
},
|
||||
}} />
|
||||
</div>;
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -97,7 +109,7 @@ export default async function ImagePhotoGrid({
|
||||
gap,
|
||||
}}
|
||||
>
|
||||
{hasSplitLayout
|
||||
{hasSplitLayout && photoUrls.length >= 3
|
||||
? <>
|
||||
{/* Large image (L) */}
|
||||
<div style={{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user