Await app view when handling blocks mutes for lists (#2151)

* Await app view when handling blocks mutes for lists

* Do it right this time
zio/stable
Eric Bailey 2023-12-08 17:55:35 -06:00 committed by GitHub
parent 565979e71f
commit 1b8b1b2ed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -230,6 +230,10 @@ export function useListMuteMutation() {
} else { } else {
await getAgent().unmuteModList(uri) await getAgent().unmuteModList(uri)
} }
await whenAppViewReady(uri, (v: AppBskyGraphGetList.Response) => {
return Boolean(v?.data.list.viewer?.muted) === mute
})
}, },
onSuccess(data, variables) { onSuccess(data, variables) {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
@ -248,6 +252,12 @@ export function useListBlockMutation() {
} else { } else {
await getAgent().unblockModList(uri) await getAgent().unblockModList(uri)
} }
await whenAppViewReady(uri, (v: AppBskyGraphGetList.Response) => {
return block
? typeof v?.data.list.viewer?.blocked === 'string'
: !v?.data.list.viewer?.blocked
})
}, },
onSuccess(data, variables) { onSuccess(data, variables) {
queryClient.invalidateQueries({ queryClient.invalidateQueries({