Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(trip): redirect to plan tab when active tab's addon is disabled

jubnl306626ee1c8b
diff --git a/client/src/pages/TripPlannerPage.tsx b/client/src/pages/TripPlannerPage.tsx
index 2a9225b09..d2c0c2a31 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)