Merge pull request #2486 from homarr-labs/feat/fix-cf-compile

This commit is contained in:
Thomas Camlong
2025-11-17 13:11:55 +01:00
committed by GitHub
4 changed files with 11 additions and 6 deletions

View File

@@ -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()

View File

@@ -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() {

View File

@@ -122,6 +122,8 @@ async function fetchAuthorData(authorId: number) {
}
}
const authorDataCache: Record<number, AuthorData> = {};
/**
* 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<AuthorData> {
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;
}
/**

View File

@@ -11,3 +11,5 @@ export class ApiError extends Error {
}
}