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) <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-06-05 15:12:59 +03:00
parent 96e321dfd9
commit 6a68fc6305
@@ -418,67 +418,34 @@ export function ListConvosProviderInner({
})), })),
) )
} else if (ChatBskyConvoDefs.isLogLockConvo(log)) { } else if (ChatBskyConvoDefs.isLogLockConvo(log)) {
queryClient.setQueriesData( mutateConvoView(log.convoId, convo =>
{queryKey: [RQKEY_ROOT]}, ChatBskyConvoDefs.isGroupConvo(convo.kind)
(old?: ConvoListQueryData) => ? {
optimisticUpdate(log.convoId, old, convo => {
if (ChatBskyConvoDefs.isGroupConvo(convo.kind)) {
return {
...convo, ...convo,
kind: { kind: {...convo.kind, lockStatus: 'locked'},
...convo.kind,
lockStatus: 'locked',
},
rev: log.rev, rev: log.rev,
} }
} : {...convo, rev: log.rev},
return {
...convo,
rev: log.rev,
}
}),
) )
} else if (ChatBskyConvoDefs.isLogUnlockConvo(log)) { } else if (ChatBskyConvoDefs.isLogUnlockConvo(log)) {
queryClient.setQueriesData( mutateConvoView(log.convoId, convo =>
{queryKey: [RQKEY_ROOT]}, ChatBskyConvoDefs.isGroupConvo(convo.kind)
(old?: ConvoListQueryData) => ? {
optimisticUpdate(log.convoId, old, convo => {
if (ChatBskyConvoDefs.isGroupConvo(convo.kind)) {
return {
...convo, ...convo,
kind: { kind: {...convo.kind, lockStatus: 'unlocked'},
...convo.kind,
lockStatus: 'unlocked',
},
rev: log.rev, rev: log.rev,
} }
} : {...convo, rev: log.rev},
return {
...convo,
rev: log.rev,
}
}),
) )
} else if (ChatBskyConvoDefs.isLogLockConvoPermanently(log)) { } else if (ChatBskyConvoDefs.isLogLockConvoPermanently(log)) {
queryClient.setQueriesData( mutateConvoView(log.convoId, convo =>
{queryKey: [RQKEY_ROOT]}, ChatBskyConvoDefs.isGroupConvo(convo.kind)
(old?: ConvoListQueryData) => ? {
optimisticUpdate(log.convoId, old, convo => {
if (ChatBskyConvoDefs.isGroupConvo(convo.kind)) {
return {
...convo, ...convo,
kind: { kind: {...convo.kind, lockStatus: 'locked-permanently'},
...convo.kind,
lockStatus: 'locked-permanently',
},
rev: log.rev, rev: log.rev,
} }
} : {...convo, rev: log.rev},
return {
...convo,
rev: log.rev,
}
}),
) )
} else if ( } else if (
ChatBskyConvoDefs.isLogCreateJoinLink(log) || ChatBskyConvoDefs.isLogCreateJoinLink(log) ||