From 6a68fc63053fe61dc58f0337c2ac0979b8d40d00 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 5 Jun 2026 15:12:59 +0300 Subject: [PATCH] sync single-convo cache on chat lock firehose events Lock/unlock firehose events only wrote the convo-list cache, so an open group chat would not update its composer footer or the agent's lockStatus live - only after a refetch. Route the three lock handlers through mutateConvoView so the single-convo cache (CONVO_KEY) is updated too, which fires the ConvoProvider subscription and flips the footer live. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../queries/messages/list-conversations.tsx | 63 +++++-------------- 1 file changed, 15 insertions(+), 48 deletions(-) diff --git a/src/state/queries/messages/list-conversations.tsx b/src/state/queries/messages/list-conversations.tsx index f026e57d33..dadf30bcdf 100644 --- a/src/state/queries/messages/list-conversations.tsx +++ b/src/state/queries/messages/list-conversations.tsx @@ -418,67 +418,34 @@ export function ListConvosProviderInner({ })), ) } else if (ChatBskyConvoDefs.isLogLockConvo(log)) { - queryClient.setQueriesData( - {queryKey: [RQKEY_ROOT]}, - (old?: ConvoListQueryData) => - optimisticUpdate(log.convoId, old, convo => { - if (ChatBskyConvoDefs.isGroupConvo(convo.kind)) { - return { - ...convo, - kind: { - ...convo.kind, - lockStatus: 'locked', - }, - rev: log.rev, - } - } - return { + mutateConvoView(log.convoId, convo => + ChatBskyConvoDefs.isGroupConvo(convo.kind) + ? { ...convo, + kind: {...convo.kind, lockStatus: 'locked'}, rev: log.rev, } - }), + : {...convo, rev: log.rev}, ) } else if (ChatBskyConvoDefs.isLogUnlockConvo(log)) { - queryClient.setQueriesData( - {queryKey: [RQKEY_ROOT]}, - (old?: ConvoListQueryData) => - optimisticUpdate(log.convoId, old, convo => { - if (ChatBskyConvoDefs.isGroupConvo(convo.kind)) { - return { - ...convo, - kind: { - ...convo.kind, - lockStatus: 'unlocked', - }, - rev: log.rev, - } - } - return { + mutateConvoView(log.convoId, convo => + ChatBskyConvoDefs.isGroupConvo(convo.kind) + ? { ...convo, + kind: {...convo.kind, lockStatus: 'unlocked'}, rev: log.rev, } - }), + : {...convo, rev: log.rev}, ) } else if (ChatBskyConvoDefs.isLogLockConvoPermanently(log)) { - queryClient.setQueriesData( - {queryKey: [RQKEY_ROOT]}, - (old?: ConvoListQueryData) => - optimisticUpdate(log.convoId, old, convo => { - if (ChatBskyConvoDefs.isGroupConvo(convo.kind)) { - return { - ...convo, - kind: { - ...convo.kind, - lockStatus: 'locked-permanently', - }, - rev: log.rev, - } - } - return { + mutateConvoView(log.convoId, convo => + ChatBskyConvoDefs.isGroupConvo(convo.kind) + ? { ...convo, + kind: {...convo.kind, lockStatus: 'locked-permanently'}, rev: log.rev, } - }), + : {...convo, rev: log.rev}, ) } else if ( ChatBskyConvoDefs.isLogCreateJoinLink(log) ||