Skip to content

Commit 35cb225

Browse files
committed
fix: loading: disable loading correctly
short circuit logic when a request comes back prevented the loading spinner from being hidden
1 parent 5236af3 commit 35cb225

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/autocomplete/autocomplete.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ export default ({
4747
// search queries the autocomplete API
4848
const search = useCallback(text => {
4949
autocomplete(text).then(({ features, discard }) => {
50+
setIsLoading(false)
51+
5052
if (discard || inputRef.current.value !== text) {
5153
return
5254
}
5355

54-
setIsLoading(false)
5556
setResults({ text, features })
5657
openMenu()
5758
})

0 commit comments

Comments
 (0)