Skip to content

Commit 6dbf07e

Browse files
call setViewedRoute in matchContentToUrl instead of nearby useEffect
1 parent d2915fb commit 6dbf07e

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

lib/actions/ui.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ export function matchContentToUrl(map, location) {
291291

292292
dispatch(setMainPanelContent(MainPanelContent.NEARBY_VIEW))
293293
}
294+
dispatch(setViewedRoute(null))
294295
break
295296
case 'trip':
296297
dispatch(setViewedStop(null))

lib/components/viewers/nearby/nearby-view.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ type Props = {
8888
setMainPanelContent: (content: number) => void
8989
setNearbyViewFilter: (arg: NearbyFilters) => void
9090
setViewedNearbyCoords: (location: Location | null) => void
91-
setViewedRoute: () => void
9291
zoomToPlace: ZoomToPlaceHandler
9392
}
9493

@@ -182,7 +181,6 @@ function NearbyView({
182181
setMainPanelContent,
183182
setNearbyViewFilter,
184183
setViewedNearbyCoords,
185-
setViewedRoute,
186184
zoomToPlace
187185
}: Props): JSX.Element {
188186
const map = useMap().default
@@ -202,11 +200,6 @@ function NearbyView({
202200
[nearbyViewCoords, currentPosition, map]
203201
)
204202

205-
// Clear viewed route when entering nearby view
206-
useEffect(() => {
207-
setViewedRoute()
208-
}, [setViewedRoute])
209-
210203
const reverseCoords = async (coords: LonLatInput) => {
211204
try {
212205
const location = await getGeocoder(geocoderConfig).reverse({
@@ -575,7 +568,6 @@ const mapDispatchToProps = {
575568
setMainPanelContent: uiActions.setMainPanelContent,
576569
setNearbyViewFilter: uiActions.setNearbyViewFilter,
577570
setViewedNearbyCoords: uiActions.setViewedNearbyCoords,
578-
setViewedRoute: uiActions.setViewedRoute,
579571
viewNearby: uiActions.viewNearby,
580572
zoomToPlace: mapActions.zoomToPlace
581573
}

0 commit comments

Comments
 (0)