File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,16 @@ export const generateMetadata = async (): Promise<Metadata> => {
1616 }
1717}
1818
19+ // ref: https://github.com/opennextjs/opennextjs-cloudflare/issues/652
20+ export const dynamic = "force-dynamic"
21+
1922const getArticleLikes = async ( articles : Article [ ] ) => {
2023 const articleIds = articles . map ( ( article ) => article . id )
2124 const query = `select article_id, count(*) from likes where article_id in (${ articleIds . map (
2225 ( ) => "?" ,
2326 ) } ) group by article_id`
2427
25- const context = await getCloudflareContext ( { async : true } )
28+ const context = getCloudflareContext ( )
2629 const { results } = await context . env . DB . prepare ( query )
2730 . bind ( ...articleIds )
2831 . all < { article_id : string ; "count(*)" : string } > ( )
@@ -38,8 +41,8 @@ const friendLinks = [
3841
3942export default async function Home ( ) {
4043 const articles = allArticles . toReversed ( )
41- const likes = await getArticleLikes ( articles )
4244 const recentTweets = await getRecentTweets ( )
45+ const likes = await getArticleLikes ( articles )
4346
4447 const articlesWithLikes = articles . map ( ( article ) => {
4548 const like = likes . find ( ( like ) => like . article_id === article . id )
You can’t perform that action at this time.
0 commit comments