mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-11-18 17:47:30 +01:00
Merge pull request #2486 from homarr-labs/feat/fix-cf-compile
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,3 +11,5 @@ export class ApiError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user