mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-11-19 10:07:29 +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"
|
import { getCommunityGalleryRecord, getCommunitySubmissionByName, getCommunitySubmissions } from "@/lib/community"
|
||||||
|
|
||||||
export const revalidate = 21600 // 6 hours
|
export const revalidate = 21600 // 6 hours
|
||||||
export const runtime = 'edge';
|
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
const icons = await getCommunitySubmissions()
|
const icons = await getCommunitySubmissions()
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { join } from "node:path"
|
|||||||
import { ImageResponse } from "next/og"
|
import { ImageResponse } from "next/og"
|
||||||
import { getAllIcons } from "@/lib/api"
|
import { getAllIcons } from "@/lib/api"
|
||||||
|
|
||||||
export const runtime = 'edge';
|
|
||||||
export const revalidate = false
|
export const revalidate = false
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ async function fetchAuthorData(authorId: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const authorDataCache: Record<number, AuthorData> = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached version of fetchAuthorData
|
* Cached version of fetchAuthorData
|
||||||
* Uses unstable_cache with tags for on-demand revalidation
|
* Uses unstable_cache with tags for on-demand revalidation
|
||||||
@@ -132,10 +134,13 @@ async function fetchAuthorData(authorId: number) {
|
|||||||
* across multiple page builds and requests.
|
* across multiple page builds and requests.
|
||||||
*/
|
*/
|
||||||
export async function getAuthorData(authorId: number): Promise<AuthorData> {
|
export async function getAuthorData(authorId: number): Promise<AuthorData> {
|
||||||
return unstable_cache(async () => await fetchAuthorData(authorId), [`author-${authorId}`], {
|
if (authorDataCache[authorId]) {
|
||||||
revalidate: 86400,
|
return authorDataCache[authorId];
|
||||||
tags: ["authors", `author-${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