Fix some useEffect() cleanup issues

This commit is contained in:
Paul Frazee 2022-10-26 14:48:15 -05:00
parent 1983512fef
commit 1ab8285ad3
6 changed files with 38 additions and 2 deletions

View file

@ -33,13 +33,18 @@ export function Component({
const [autocompleteOptions, setAutocompleteOptions] = useState<string[]>([])
useEffect(() => {
let aborted = false
store.api.app.bsky
.getUserFollows({
user: store.me.did || '',
})
.then(res => {
if (aborted) return
setFollowedUsers(res.data.follows)
})
return () => {
aborted = true
}
})
const onChangeText = (newText: string) => {