diff --git a/src/lib/notion.ts b/src/lib/notion.ts index deda3f3..3adb662 100644 --- a/src/lib/notion.ts +++ b/src/lib/notion.ts @@ -1,5 +1,7 @@ 'use server' +import { cache } from 'react' + import { WATCH_RESOURCES_PAGE_SIZE } from '@/constants/globals' import { Client } from '@notionhq/client' @@ -7,7 +9,7 @@ const notion = new Client({ auth: process.env.NOTION_TOKEN, }) -export const fetchWatchPages = async (cursor?: string | null) => { +export const fetchWatchPages = cache((cursor?: string | null) => { return notion.databases.query({ database_id: process.env.NOTION_DATABASE_ID!, start_cursor: cursor ?? undefined, @@ -27,4 +29,4 @@ export const fetchWatchPages = async (cursor?: string | null) => { checkbox: { equals: true }, }, }) -} +})