Skip to content

Commit 54e9062

Browse files
authored
Fix #11387 Itinerary geosearch reset (#11675)
1 parent 2678ee9 commit 54e9062

4 files changed

Lines changed: 398 additions & 5 deletions

File tree

web/client/plugins/Itinerary/components/geosearchpicker/GeoSearchPicker.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
import React from 'react';
9+
import React, { useEffect } from 'react';
1010
import isNil from 'lodash/isNil';
1111
import cloneDeep from 'lodash/cloneDeep';
1212
import get from 'lodash/get';
@@ -20,6 +20,7 @@ import draggableContainer from '../../../../components/misc/enhancers/draggableC
2020
import { generateTemplateString } from '../../../../utils/TemplateUtils';
2121
import { WAYPOINT_MARKER_COLORS } from '../../constants';
2222
import { createMarkerSvgDataUrl } from '../../../../utils/StyleUtils';
23+
import { getDefaultWaypoints } from '../../utils/ItineraryUtils';
2324

2425
/**
2526
* GeoSearchPicker component
@@ -60,6 +61,16 @@ const GeoSearchPicker = draggableContainer(({
6061
onSetWaypoints(newWaypoints);
6162
};
6263

64+
useEffect(() => {
65+
return () => {
66+
onSetWaypoints(getDefaultWaypoints());
67+
onUpdateLocations([]);
68+
onSearchByLocationName('');
69+
onSelectLocationFromMap(null);
70+
onToggleCoordinateEditor([]);
71+
};
72+
}, []);
73+
6374
const handleLocationSelect = (idx, result) => {
6475
const newWaypoints = cloneDeep(waypoints);
6576
newWaypoints[idx] = {

0 commit comments

Comments
 (0)