diff options
Diffstat (limited to 'src/view/com')
-rw-r--r-- | src/view/com/modals/ComposePost.tsx | 5 | ||||
-rw-r--r-- | src/view/com/util/UserInfoText.tsx | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/view/com/modals/ComposePost.tsx b/src/view/com/modals/ComposePost.tsx index 0032fbe7c..806b5d7a0 100644 --- a/src/view/com/modals/ComposePost.tsx +++ b/src/view/com/modals/ComposePost.tsx @@ -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) => { diff --git a/src/view/com/util/UserInfoText.tsx b/src/view/com/util/UserInfoText.tsx index 54cb93f71..536eef9e4 100644 --- a/src/view/com/util/UserInfoText.tsx +++ b/src/view/com/util/UserInfoText.tsx @@ -29,15 +29,21 @@ export function UserInfoText({ const [didFail, setFailed] = useState<boolean>(false) useEffect(() => { + let aborted = false // TODO use caching to reduce loads store.api.app.bsky.getProfile({user: did}).then( v => { + if (aborted) return setProfile(v.data) }, _err => { + if (aborted) return setFailed(true) }, ) + return () => { + aborted = true + } }, [did, store.api.app.bsky]) return ( |