refactor(community): rename and export fetchCommunitySubmissions function for improved data fetching

This commit is contained in:
Thomas Camlong
2026-01-09 00:57:40 +01:00
parent 8809d8a00c
commit 76b7af5fae
2 changed files with 5 additions and 3 deletions

View File

@@ -2,7 +2,9 @@ import type { Metadata } from "next"
import { Suspense } from "react"
import { CommunityIconSearch } from "@/components/community-icon-search"
import { BASE_URL } from "@/constants"
import { getCommunitySubmissions } from "@/lib/community"
import { fetchCommunitySubmissions, getCommunitySubmissions } from "@/lib/community"
export const revalidate = 300
export async function generateMetadata(): Promise<Metadata> {
const icons = await getCommunitySubmissions()
@@ -39,7 +41,7 @@ export async function generateMetadata(): Promise<Metadata> {
}
export default async function CommunityPage() {
const icons = await getCommunitySubmissions()
const icons = await fetchCommunitySubmissions();
return (
<div className="isolate overflow-hidden p-2 mx-auto max-w-7xl">
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">

View File

@@ -118,7 +118,7 @@ function transformGalleryToIcon(item: CommunityGallery): any {
* Uses the community_gallery view collection for public-facing data
* This is the raw fetch function without caching
*/
async function fetchCommunitySubmissions(): Promise<IconWithName[]> {
export async function fetchCommunitySubmissions(): Promise<IconWithName[]> {
try {
const pb = createServerPB()