diff --git a/web/src/app/community/[icon]/opengraph-image.tsx b/web/src/app/community/[icon]/opengraph-image.tsx index f96bb646..61da7c4c 100644 --- a/web/src/app/community/[icon]/opengraph-image.tsx +++ b/web/src/app/community/[icon]/opengraph-image.tsx @@ -3,7 +3,6 @@ import { ImageResponse } from "next/og" import { getCommunityGalleryRecord, getCommunitySubmissionByName, getCommunitySubmissions } from "@/lib/community" export const revalidate = 21600 // 6 hours -export const runtime = 'edge'; export async function generateStaticParams() { const icons = await getCommunitySubmissions() diff --git a/web/src/app/icons/[icon]/opengraph-image.tsx b/web/src/app/icons/[icon]/opengraph-image.tsx index f30dec11..e490b39d 100644 --- a/web/src/app/icons/[icon]/opengraph-image.tsx +++ b/web/src/app/icons/[icon]/opengraph-image.tsx @@ -3,7 +3,6 @@ import { join } from "node:path" import { ImageResponse } from "next/og" import { getAllIcons } from "@/lib/api" -export const runtime = 'edge'; export const revalidate = false export async function generateStaticParams() { diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index 7bbccadc..275f5294 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -122,6 +122,8 @@ async function fetchAuthorData(authorId: number) { } } +const authorDataCache: Record = {}; + /** * Cached version of fetchAuthorData * Uses unstable_cache with tags for on-demand revalidation @@ -132,10 +134,13 @@ async function fetchAuthorData(authorId: number) { * across multiple page builds and requests. */ export async function getAuthorData(authorId: number): Promise { - return unstable_cache(async () => await fetchAuthorData(authorId), [`author-${authorId}`], { - revalidate: 86400, - tags: ["authors", `author-${authorId}`], - })() + if (authorDataCache[authorId]) { + return authorDataCache[authorId]; + } + + const data = await fetchAuthorData(authorId); + authorDataCache[authorId] = data; + return data; } /** diff --git a/web/src/lib/errors.ts b/web/src/lib/errors.ts index 28600798..7c7b203a 100644 --- a/web/src/lib/errors.ts +++ b/web/src/lib/errors.ts @@ -11,3 +11,5 @@ export class ApiError extends Error { } } + +