feature/IO-3000-messaging-sockets-migrations2 -
- Checkpoint, archiving works, cannot unarchive yet Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -152,6 +152,38 @@ export const registerMessagingHandlers = ({ socket, client }) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === "conversation-archived") {
|
||||
// Remove all messages associated with this conversation
|
||||
const messageRefs = client.cache.readFragment({
|
||||
id: cacheId,
|
||||
fragment: gql`
|
||||
fragment ConversationMessages on conversations {
|
||||
messages {
|
||||
id
|
||||
}
|
||||
}
|
||||
`
|
||||
});
|
||||
|
||||
if (messageRefs?.messages) {
|
||||
messageRefs.messages.forEach((message) => {
|
||||
const messageCacheId = client.cache.identify({
|
||||
__typename: "messages",
|
||||
id: message.id
|
||||
});
|
||||
if (messageCacheId) {
|
||||
client.cache.evict({ id: messageCacheId });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Evict the conversation itself
|
||||
client.cache.evict({ id: cacheId });
|
||||
client.cache.gc(); // Trigger garbage collection to clean up unused entries
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
client.cache.modify({
|
||||
id: cacheId,
|
||||
fields: {
|
||||
|
||||
Reference in New Issue
Block a user