From 8bd061abdb41977ccdfd167a2ee219d7943256a8 Mon Sep 17 00:00:00 2001 From: polypixeldev Date: Thu, 16 Jan 2025 18:42:38 -0500 Subject: [PATCH] fix caching --- src/app/harbor/tavern/tavern-utils.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/harbor/tavern/tavern-utils.ts b/src/app/harbor/tavern/tavern-utils.ts index 2ceb9ef3..011aca61 100644 --- a/src/app/harbor/tavern/tavern-utils.ts +++ b/src/app/harbor/tavern/tavern-utils.ts @@ -40,11 +40,16 @@ export const getTavernPeople = async () => { }) .all() - return records.map((r) => ({ + const items = records.map((r) => ({ id: r.id, status: r.get('tavern_rsvp_status'), coordinates: r.get('tavern_map_coordinates'), })) as TavernPersonItem[] + + cachedPeople = items + lastPeopleFetch = Date.now() + + return items } export const getTavernEvents = async () => { @@ -59,10 +64,14 @@ export const getTavernEvents = async () => { }) .all() - return records.map((r) => ({ + const items = records.map((r) => ({ id: r.id, city: r.get('city'), geocode: r.get('map_geocode'), organizers: r.get('organizers') ?? [], })) as TavernEventItem[] + + cachedEvents = items + lastEventsFetch = Date.now() + return items }