From 0e9505b1815ef2f233dd675996016b69f2f9daf1 Mon Sep 17 00:00:00 2001 From: Onni Hakala Date: Sat, 17 Feb 2024 10:59:33 +0100 Subject: [PATCH] Fix #319 recently created pages cache 404 page Co-authored-by: Luiz Felicio <13091635+luizeboli@users.noreply.github.com> --- lib/get-site-map.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/get-site-map.ts b/lib/get-site-map.ts index 984e3dbdb9..59869b3582 100644 --- a/lib/get-site-map.ts +++ b/lib/get-site-map.ts @@ -6,8 +6,10 @@ import * as types from './types' import { includeNotionIdInUrls } from './config' import { getCanonicalPageId } from './get-canonical-page-id' import { notion } from './notion-api' +import ExpiryMap from 'expiry-map' const uuid = !!includeNotionIdInUrls +const cache = new ExpiryMap(10000) export async function getSiteMap(): Promise { const partialSiteMap = await getAllPages( @@ -22,7 +24,8 @@ export async function getSiteMap(): Promise { } const getAllPages = pMemoize(getAllPagesImpl, { - cacheKey: (...args) => JSON.stringify(args) + cacheKey: (...args) => JSON.stringify(args), + cache }) async function getAllPagesImpl(