From d2915fba737e9e91b2c2bcc75953ec6df76831a4 Mon Sep 17 00:00:00 2001 From: Amy Corson <115499534+amy-corson-ibigroup@users.noreply.github.com> Date: Thu, 13 Nov 2025 10:06:04 -0600 Subject: [PATCH 1/2] Clear viewed route in nearby view --- lib/actions/ui.js | 18 ++++++++++-------- lib/components/viewers/nearby/nearby-view.tsx | 8 ++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/actions/ui.js b/lib/actions/ui.js index 2079bb989..403e052a0 100644 --- a/lib/actions/ui.js +++ b/lib/actions/ui.js @@ -95,14 +95,16 @@ export function setViewedRoute(payload) { dispatch(viewRoute(payload)) - const path = getPathFromParts( - 'route', - payload?.routeId, - // If a pattern is supplied, include pattern in path - payload?.patternId && 'pattern', - payload?.patternId - ) - dispatch(routeTo(path)) + if (payload?.routeId) { + const path = getPathFromParts( + 'route', + payload?.routeId, + // If a pattern is supplied, include pattern in path + payload?.patternId && 'pattern', + payload?.patternId + ) + dispatch(routeTo(path)) + } } } diff --git a/lib/components/viewers/nearby/nearby-view.tsx b/lib/components/viewers/nearby/nearby-view.tsx index 239bbf068..9d83f84d0 100644 --- a/lib/components/viewers/nearby/nearby-view.tsx +++ b/lib/components/viewers/nearby/nearby-view.tsx @@ -88,6 +88,7 @@ type Props = { setMainPanelContent: (content: number) => void setNearbyViewFilter: (arg: NearbyFilters) => void setViewedNearbyCoords: (location: Location | null) => void + setViewedRoute: () => void zoomToPlace: ZoomToPlaceHandler } @@ -181,6 +182,7 @@ function NearbyView({ setMainPanelContent, setNearbyViewFilter, setViewedNearbyCoords, + setViewedRoute, zoomToPlace }: Props): JSX.Element { const map = useMap().default @@ -200,6 +202,11 @@ function NearbyView({ [nearbyViewCoords, currentPosition, map] ) + // Clear viewed route when entering nearby view + useEffect(() => { + setViewedRoute() + }, [setViewedRoute]) + const reverseCoords = async (coords: LonLatInput) => { try { const location = await getGeocoder(geocoderConfig).reverse({ @@ -568,6 +575,7 @@ const mapDispatchToProps = { setMainPanelContent: uiActions.setMainPanelContent, setNearbyViewFilter: uiActions.setNearbyViewFilter, setViewedNearbyCoords: uiActions.setViewedNearbyCoords, + setViewedRoute: uiActions.setViewedRoute, viewNearby: uiActions.viewNearby, zoomToPlace: mapActions.zoomToPlace } From 6dbf07e2fc341a1c8479d9d9c322f964c07e20de Mon Sep 17 00:00:00 2001 From: Amy Corson <115499534+amy-corson-ibigroup@users.noreply.github.com> Date: Wed, 19 Nov 2025 13:30:11 -0600 Subject: [PATCH 2/2] call setViewedRoute in matchContentToUrl instead of nearby useEffect --- lib/actions/ui.js | 1 + lib/components/viewers/nearby/nearby-view.tsx | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/actions/ui.js b/lib/actions/ui.js index 403e052a0..fae0b9a83 100644 --- a/lib/actions/ui.js +++ b/lib/actions/ui.js @@ -291,6 +291,7 @@ export function matchContentToUrl(map, location) { dispatch(setMainPanelContent(MainPanelContent.NEARBY_VIEW)) } + dispatch(setViewedRoute(null)) break case 'trip': dispatch(setViewedStop(null)) diff --git a/lib/components/viewers/nearby/nearby-view.tsx b/lib/components/viewers/nearby/nearby-view.tsx index 9d83f84d0..239bbf068 100644 --- a/lib/components/viewers/nearby/nearby-view.tsx +++ b/lib/components/viewers/nearby/nearby-view.tsx @@ -88,7 +88,6 @@ type Props = { setMainPanelContent: (content: number) => void setNearbyViewFilter: (arg: NearbyFilters) => void setViewedNearbyCoords: (location: Location | null) => void - setViewedRoute: () => void zoomToPlace: ZoomToPlaceHandler } @@ -182,7 +181,6 @@ function NearbyView({ setMainPanelContent, setNearbyViewFilter, setViewedNearbyCoords, - setViewedRoute, zoomToPlace }: Props): JSX.Element { const map = useMap().default @@ -202,11 +200,6 @@ function NearbyView({ [nearbyViewCoords, currentPosition, map] ) - // Clear viewed route when entering nearby view - useEffect(() => { - setViewedRoute() - }, [setViewedRoute]) - const reverseCoords = async (coords: LonLatInput) => { try { const location = await getGeocoder(geocoderConfig).reverse({ @@ -575,7 +568,6 @@ const mapDispatchToProps = { setMainPanelContent: uiActions.setMainPanelContent, setNearbyViewFilter: uiActions.setNearbyViewFilter, setViewedNearbyCoords: uiActions.setViewedNearbyCoords, - setViewedRoute: uiActions.setViewedRoute, viewNearby: uiActions.viewNearby, zoomToPlace: mapActions.zoomToPlace }