diff --git a/frontend/app/map/page.tsx b/frontend/app/map/page.tsx index 6969d5ea..99400ece 100644 --- a/frontend/app/map/page.tsx +++ b/frontend/app/map/page.tsx @@ -61,7 +61,8 @@ export default function MapPage() { fetcher, { revalidateOnFocus: false, - revalidateOnReconnect: false, + revalidateOnReconnect: true, + revalidateOnMount: true, keepPreviousData: true, } ) @@ -151,15 +152,28 @@ export default function MapPage() { for (const excursion of vesselExcursions) { const segments = await getVesselSegments( vesselID, - excursion.excursion_id + excursion.excursion_id, + startDate, + endDate ) excursion.segments = segments.data + console.log(excursion.arrival_at == undefined) const timeByMPAZone = await getVesselTimeByZone({ vesselId: vesselID, category: ZoneCategory.AMP, - startAt: startDate ? startDate > new Date(excursion.departure_at) ? new Date(startDate) : new Date(excursion.departure_at) : undefined, - endAt: endDate ? endDate < new Date(excursion.arrival_at!) ? new Date(endDate) : new Date(excursion.arrival_at!) : undefined, + startAt: startDate + ? startDate > new Date(excursion.departure_at) + ? new Date(startDate) + : new Date(excursion.departure_at) + : undefined, + endAt: endDate + ? excursion.arrival_at != undefined + ? endDate < new Date(excursion.arrival_at!) + ? new Date(endDate!) + : new Date(excursion.arrival_at!) + : new Date(endDate!) + : undefined, }) excursion.timeByMPAZone = timeByMPAZone console.log("timeByMPAZone", timeByMPAZone)