From 723a0fb3a867c4b6cc36a3e0c26c2af57d8f4085 Mon Sep 17 00:00:00 2001 From: Satyam-Rastogi Date: Tue, 19 May 2026 00:32:46 +0530 Subject: [PATCH] feat(storm-intel): auto-select latest event on map at first load --- src/pages/StormIntelPage.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/StormIntelPage.jsx b/src/pages/StormIntelPage.jsx index 4ba9478..5e3c63d 100644 --- a/src/pages/StormIntelPage.jsx +++ b/src/pages/StormIntelPage.jsx @@ -928,6 +928,15 @@ const StormIntelPage = () => { const { events: allEvents } = useStormEvents({ dateRange: '36m' }); const { forecast, loading: forecastLoading, alertDay, hasStormAlert } = useStormForecast(); + // Auto-select the most recent event on first load (no drawer, no fly) + const hasAutoSelected = useRef(false); + useEffect(() => { + if (!hasAutoSelected.current && events.length > 0) { + hasAutoSelected.current = true; + setSelectedStorm(events[0]); + } + }, [events]); + const handleTogglePin = useCallback((id) => { setPinnedIds(prev => { const next = new Set(prev);