Skip to content

Commit ae0a8ba

Browse files
committed
again minor bug necessary: don't show list for first focus (ie. initial load)
1 parent 1a95776 commit ae0a8ba

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/sidebar/search/AddressInput.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,15 @@ export default function AddressInput(props: AddressInputProps) {
8585
}, [props.point])
8686

8787
useEffect(() => {
88-
if (hasFocus && !isInitialFocus.current && text === '') {
88+
if (!hasFocus) return
89+
if (isInitialFocus.current) {
90+
isInitialFocus.current = false
91+
return
92+
}
93+
if (text === '') {
8994
const recents = buildRecentItems(undefined, 5, excludeCoord)
9095
if (recents.length > 0) setAutocompleteItems(recents)
9196
}
92-
isInitialFocus.current = false
9397
}, [hasFocus, excludeCoord])
9498

9599
// highlighted result of geocoding results. Keep track which index is highlighted and change things on ArrowUp and Down

0 commit comments

Comments
 (0)