From 306626ee1c8bd0b162ba9f712e3dd75cfc5c69a3 Mon Sep 17 00:00:00 2001 From: jubnl Date: Sun, 5 Apr 2026 22:29:46 +0200 Subject: [PATCH] fix(trip): redirect to plan tab when active tab's addon is disabled If a user's last visited tab belongs to an addon that gets disabled while they are away, re-opening the trip now resets the active tab to 'plan' instead of rendering the inaccessible addon page. Closes #441 --- client/src/pages/TripPlannerPage.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/pages/TripPlannerPage.tsx b/client/src/pages/TripPlannerPage.tsx index 2a9225b..d2c0c2a 100644 --- a/client/src/pages/TripPlannerPage.tsx +++ b/client/src/pages/TripPlannerPage.tsx @@ -137,6 +137,14 @@ export default function TripPlannerPage(): React.ReactElement | null { return saved || 'plan' }) + useEffect(() => { + const validTabIds = TRIP_TABS.map(t => t.id) + if (!validTabIds.includes(activeTab)) { + setActiveTab('plan') + sessionStorage.setItem(`trip-tab-${tripId}`, 'plan') + } + }, [enabledAddons]) + const handleTabChange = (tabId: string): void => { setActiveTab(tabId) sessionStorage.setItem(`trip-tab-${tripId}`, tabId)