From 74d2a81cd3566f62f8631d67b8b85c8f1bb273ee Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Fri, 7 Nov 2025 08:35:32 +0100 Subject: [PATCH] refactor: improve opengraph image generation with better fallback handling - Add `revalidate = false` to disable revalidation for static images - Refactor iconUrl to be null when icon not found, using placeholder only in img src - This provides cleaner separation between data and presentation logic --- web/src/app/icons/[icon]/opengraph-image.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/app/icons/[icon]/opengraph-image.tsx b/web/src/app/icons/[icon]/opengraph-image.tsx index 330b09e3..23f9ac41 100644 --- a/web/src/app/icons/[icon]/opengraph-image.tsx +++ b/web/src/app/icons/[icon]/opengraph-image.tsx @@ -4,6 +4,8 @@ import { ImageResponse } from "next/og" import { getAllIcons } from "@/lib/api" export const dynamic = "force-static" +export const revalidate = false + export async function generateStaticParams() { const iconsData = await getAllIcons() @@ -72,7 +74,7 @@ export default async function Image({ params }: { params: Promise<{ icon: string // Convert the image data to a data URL or use placeholder const iconUrl = iconData ? `data:image/png;base64,${iconData.toString("base64")}` - : `https://placehold.co/600x400?text=${formattedIconName}` + : null return new ImageResponse(