Skip to content

Commit

Permalink
fix: flickering on navigation from destination to activity page by pr…
Browse files Browse the repository at this point in the history
…eloading
  • Loading branch information
joshuaisaact committed Nov 6, 2024
1 parent 1056321 commit 83adccf
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/pages/DestinationSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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] || [] : [];
Expand Down

0 comments on commit 83adccf

Please sign in to comment.