From 83adccff4db541ef56eb8432fe7422cd9f4b962b Mon Sep 17 00:00:00 2001 From: Joshua Tuddenham Date: Wed, 6 Nov 2024 13:04:21 +0000 Subject: [PATCH] fix: flickering on navigation from destination to activity page by preloading --- src/pages/DestinationSummary.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pages/DestinationSummary.tsx b/src/pages/DestinationSummary.tsx index 8a82028..084525c 100644 --- a/src/pages/DestinationSummary.tsx +++ b/src/pages/DestinationSummary.tsx @@ -20,17 +20,14 @@ function DestinationSummary() { // Load activities if needed when switching to activities or insights useEffect(() => { const loadActivitiesIfNeeded = async () => { - if ( - (activeTab === 'activities' || activeTab === 'insights') && - destinationName && - !activities[destinationName] - ) { + if (destinationName && !activities[destinationName]) { await loadDestinationActivities(destinationName); } }; loadActivitiesIfNeeded(); - }, [activeTab, destinationName, activities, loadDestinationActivities]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); const destination = destinations.find((dest) => dest.destinationName === destinationName); const destinationActivities = destinationName ? activities[destinationName] || [] : [];