diff --git a/next.config.js b/next.config.js index 6494687..9b68cdf 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,8 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + experimental: { + dynamicIO: true, + }, images: { remotePatterns: [ { @@ -8,6 +11,6 @@ const nextConfig = { }, ], }, -} +}; module.exports = nextConfig; diff --git a/src/lib/supabase/getArticles.ts b/src/lib/supabase/getArticles.ts index 781adee..3f3bbc1 100644 --- a/src/lib/supabase/getArticles.ts +++ b/src/lib/supabase/getArticles.ts @@ -1,3 +1,5 @@ +'use cache'; + import camelcaseKeys from 'camelcase-keys'; import { createClient } from './server'; @@ -12,7 +14,8 @@ export type Article = { tags?: string[]; }; -const camelize = (articles: any[]) => articles.map((article) => camelcaseKeys(article)); +const camelize = (articles: any[]) => + articles.map((article) => camelcaseKeys(article)); const formatDate = (date: string) => new Date(date).toLocaleDateString('ko-KR', { @@ -35,11 +38,15 @@ const getArticles = async (params: PageParams = {}) => { const start = (page - 1) * size; const end = start + size - 1; - let query = supabase.from('articles_metadata').select('*', { count: 'exact' }); + let query = supabase + .from('articles_metadata') + .select('*', { count: 'exact' }); if (search) { const searchTerm = search.replace(/[%_]/g, '\\$&'); - query = query.or(`title.ilike.*${searchTerm}*,description.ilike.*${searchTerm}*`); + query = query.or( + `title.ilike.*${searchTerm}*,description.ilike.*${searchTerm}*`, + ); } if (tags && tags.length > 0) {