Skip to content

Commit

Permalink
fix: address search not showing recent waypoints while offline
Browse files Browse the repository at this point in the history
  • Loading branch information
pac-guerreiro committed Jul 4, 2024
1 parent 0b5bbe3 commit 363ab6f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/AddressSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function AddressSearch(
const [isTyping, setIsTyping] = useState(false);
const [isFocused, setIsFocused] = useState(false);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const [searchValue, setSearchValue] = useState(value || defaultValue || '');
const [searchValue, setSearchValue] = useState('');
const [locationErrorCode, setLocationErrorCode] = useState<GeolocationErrorCodeType>(null);
const [isFetchingCurrentLocation, setIsFetchingCurrentLocation] = useState(false);
const shouldTriggerGeolocationCallbacks = useRef(true);
Expand Down Expand Up @@ -323,11 +323,11 @@ function AddressSearch(
}, []);

const filteredPredefinedPlaces = useMemo(() => {
if (!isOffline || !searchValue) {
if (!searchValue) {
return predefinedPlaces ?? [];
}
return predefinedPlaces?.filter((predefinedPlace) => isPlaceMatchForSearch(searchValue, predefinedPlace)) ?? [];
}, [isOffline, predefinedPlaces, searchValue]);
}, [predefinedPlaces, searchValue]);

const listEmptyComponent = useCallback(
() => (!isTyping ? null : <Text style={[styles.textLabel, styles.colorMuted, styles.pv4, styles.ph3, styles.overflowAuto]}>{translate('common.noResultsFound')}</Text>),
Expand Down

0 comments on commit 363ab6f

Please sign in to comment.