feature/IO-3000-messaging-sockets-migrations2 -
- harden openMessageByPhone Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -286,23 +286,6 @@ export const registerMessagingHandlers = ({ socket, client }) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === "conversation-unarchived" || type === "conversation-archived") {
|
||||
try {
|
||||
// Refetch the conversation list and details queries
|
||||
await client.refetchQueries({
|
||||
include: [CONVERSATION_LIST_QUERY, GET_CONVERSATION_DETAILS],
|
||||
variables: [
|
||||
{ query: CONVERSATION_LIST_QUERY, variables: { offset: 0 } },
|
||||
{ query: GET_CONVERSATION_DETAILS, variables: { conversationId } }
|
||||
]
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error refetching queries after conversation state change:", error);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const cacheId = client.cache.identify({
|
||||
__typename: "conversations",
|
||||
id: conversationId
|
||||
@@ -313,6 +296,27 @@ export const registerMessagingHandlers = ({ socket, client }) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === "conversation-unarchived" || type === "conversation-archived") {
|
||||
try {
|
||||
const listQueryVariables = { offset: 0 };
|
||||
const detailsQueryVariables = { conversationId };
|
||||
|
||||
// Refetch the conversation list and details queries
|
||||
await client.refetchQueries({
|
||||
include: [CONVERSATION_LIST_QUERY, GET_CONVERSATION_DETAILS],
|
||||
variables: [
|
||||
{ query: CONVERSATION_LIST_QUERY, variables: listQueryVariables },
|
||||
{ query: GET_CONVERSATION_DETAILS, variables: detailsQueryVariables }
|
||||
]
|
||||
});
|
||||
|
||||
console.log("Refetched conversation list and details after state change.");
|
||||
} catch (error) {
|
||||
console.error("Error refetching queries after conversation state change:", error);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// Handle other types of updates (e.g., marked read, tags added/removed)
|
||||
client.cache.modify({
|
||||
id: cacheId,
|
||||
|
||||
Reference in New Issue
Block a user