Skip to content

Commit ec0ad69

Browse files
iketiunnbell-steven
authored andcommitted
Fix updating props.predefinedPlaces
1 parent d1657fa commit ec0ad69

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

GooglePlacesAutocomplete.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
141141
};
142142
// eslint-disable-next-line react-hooks/exhaustive-deps
143143
}, []);
144+
useEffect(() => {
145+
// Update dataSource if props.predefinedPlaces changed
146+
setDataSource(buildRowsFromResults([]))
147+
}, [props.predefinedPlaces])
144148

145149
useImperativeHandle(ref, () => ({
146150
setAddressText: (address) => {

0 commit comments

Comments
 (0)