Ensure mute state stays in sync after mutation (#10067)

This commit is contained in:
DS Boyce
2026-03-19 06:18:48 -07:00
committed by GitHub
parent 2a87f6f6b5
commit 876e20166a
3 changed files with 56 additions and 8 deletions
+15
View File
@@ -119,5 +119,20 @@ export function ConvoProvider({
})
}, [convo, queryClient])
useEffect(() => {
const [root, id] = getConvoKey(convoId)
return queryClient.getQueryCache().subscribe(event => {
const queryKey = event.query.queryKey as string[]
if (queryKey[0] === root && queryKey[1] === id) {
const data = event.query.state.data as
| ChatBskyConvoDefs.ConvoView
| undefined
if (data && convo.convo && data.muted !== convo.convo.muted) {
convo.updateMuted(data.muted)
}
}
})
}, [convo, convoId, queryClient])
return <ChatContext.Provider value={service}>{children}</ChatContext.Provider>
}