From 1516630f0be6fd98bc1eacee6af2b4e2bf56addf Mon Sep 17 00:00:00 2001 From: bcgov-brwang <87880048+bcgov-brwang@users.noreply.github.com> Date: Wed, 3 Jun 2026 14:35:01 -0700 Subject: [PATCH 1/2] DBC22-6431: auto open advisory panel on initial load with shared link DBC22-6431: auto open advisory panel on initial load with shared link DBC22-6431: fix the issue when advisory clicked without response on routing detail panel DBC22-6431: fix the issue when advisory clicked without response on routing detail panel - reverted DBC22-6431: fixed left issues --- src/frontend/src/Components/map/Map.js | 29 +++++++++++++++++-- .../src/Components/map/panels/index.js | 2 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/Components/map/Map.js b/src/frontend/src/Components/map/Map.js index 5c50bad64..b20888f26 100644 --- a/src/frontend/src/Components/map/Map.js +++ b/src/frontend/src/Components/map/Map.js @@ -690,6 +690,29 @@ export default function DriveBCMap(props) { }; }, []); + // Auto-open panel from URL params on initial load + useEffect(() => { + if (!mapRendered) return; + + const type = searchParams.get('type'); + const id = searchParams.get('id'); + + if (!type || !id) return; + + if (type === 'advisory') { + const advisoryData = filteredAdvisories?.find(a => a.id === parseInt(id)); + if (advisoryData) { + setTimeout(() => { + const olFeature = new Feature(); + olFeature.set('type', 'advisory'); + olFeature.set('id', advisoryData.id); + olFeature.set('data', advisoryData); + updateClickedFeature(olFeature); + }, 500); + } + } + }, [mapRendered]); + /* Map operations on location search */ useEffect(() => { if (searchLocationFrom && searchLocationFrom.length) { @@ -996,9 +1019,11 @@ export default function DriveBCMap(props) { useEffect(() => { if (searchParamInitialized.current) { if (!clickedFeature) { - searchParams.delete('type'); + if (searchParams.get('type') !== 'advisory') { + searchParams.delete('type'); + searchParams.delete('id'); + } searchParams.delete('display_category'); - searchParams.delete('id'); searchParams.delete('camIndex'); setSearchParams(searchParams, { replace: true }); } diff --git a/src/frontend/src/Components/map/panels/index.js b/src/frontend/src/Components/map/panels/index.js index 8b937871b..5dd8f0a74 100644 --- a/src/frontend/src/Components/map/panels/index.js +++ b/src/frontend/src/Components/map/panels/index.js @@ -97,7 +97,7 @@ export const resizePanel = (panelRef, clickedFeature, setMaximizedPanel) => { export const togglePanel = (panelRef, resetClickedStates, clickedFeatureRef, updateClickedFeature, pushMargins, searchedRoutes) => { if (searchedRoutes) { - panelRef.current.classList.remove('maximized'); + panelRef.current?.classList.remove('maximized'); resetClickedStates(null, clickedFeatureRef, updateClickedFeature); return; } From f0ea35be94519970a4414b362a0d4d500eb20a6c Mon Sep 17 00:00:00 2001 From: bcgov-brwang <87880048+bcgov-brwang@users.noreply.github.com> Date: Fri, 3 Jul 2026 14:16:35 -0700 Subject: [PATCH 2/2] DBC22-6431: fix on edge incognito mode --- src/frontend/src/Components/map/Map.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/Components/map/Map.js b/src/frontend/src/Components/map/Map.js index b20888f26..eed8eb1b7 100644 --- a/src/frontend/src/Components/map/Map.js +++ b/src/frontend/src/Components/map/Map.js @@ -700,6 +700,8 @@ export default function DriveBCMap(props) { if (!type || !id) return; if (type === 'advisory') { + // Advisories haven't loaded yet — wait for them, don't give up. + if (!filteredAdvisories || !filteredAdvisories.length) return; const advisoryData = filteredAdvisories?.find(a => a.id === parseInt(id)); if (advisoryData) { setTimeout(() => { @@ -710,8 +712,12 @@ export default function DriveBCMap(props) { updateClickedFeature(olFeature); }, 500); } + else { + // Advisories loaded but this id genuinely doesn't exist + setStaleLinkMessage(true); + } } - }, [mapRendered]); + }, [mapRendered, filteredAdvisories]); /* Map operations on location search */ useEffect(() => {