Skip to content

Commit

Permalink
chore: abort on state change
Browse files Browse the repository at this point in the history
  • Loading branch information
skinmaker1345 committed Mar 4, 2024
1 parent f9289dd commit 8f4b431
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ const Search: React.FC = () => {
}, 1000)
return () => {
clearTimeout(timeout)
try {
abortController.current?.abort()
abortController.current = null
} catch (e) {
return null
}
}
}, [query])

Expand Down

0 comments on commit 8f4b431

Please sign in to comment.