From 0360066f49e8238dc9f69b93f0a07b2f3521eeaf Mon Sep 17 00:00:00 2001 From: ved015 Date: Mon, 6 Apr 2026 13:26:04 +0530 Subject: [PATCH] prevent permanent caching of failed OG data fetches --- apps/web/components/memories-grid.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/web/components/memories-grid.tsx b/apps/web/components/memories-grid.tsx index 5fb4f5fd..9974f740 100644 --- a/apps/web/components/memories-grid.tsx +++ b/apps/web/components/memories-grid.tsx @@ -74,9 +74,9 @@ type OgData = { } const ogCache = new Map() -const ogInflight = new Map>() +const ogInflight = new Map>() -function fetchOgData(url: string): Promise { +function fetchOgData(url: string): Promise { const cached = ogCache.get(url) if (cached) return Promise.resolve(cached) @@ -95,10 +95,8 @@ function fetchOgData(url: string): Promise { return result }) .catch(() => { - const empty: OgData = {} - ogCache.set(url, empty) ogInflight.delete(url) - return empty + return null }) ogInflight.set(url, promise) @@ -729,7 +727,7 @@ const DocumentCard = memo( if (needsOgData && !ogData && !isLoadingOg && document.url) { setIsLoadingOg(true) fetchOgData(document.url) - .then(setOgData) + .then((data) => { if (data) setOgData(data) }) .finally(() => setIsLoadingOg(false)) } }, [needsOgData, ogData, isLoadingOg, document.url])