Skip to content

Commit

Permalink
Merge pull request #73 from joshuaisaact/minor-fixes
Browse files Browse the repository at this point in the history
fix: flickering on navigation from destination to activity page by pr…
  • Loading branch information
joshuaisaact authored Nov 6, 2024
2 parents 761014b + 83adccf commit f501201
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 f501201

Please sign in to comment.