From 42af4b1d01399937dabcf0c95cce872bebe3f5b5 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Wed, 13 Aug 2025 12:42:57 +0530 Subject: [PATCH] fix: Reset inbox on conversation switch in compose conversation modal (#12174) --- .../NewConversation/ComposeConversation.vue | 14 +++++++++----- .../components/ComposeNewConversationForm.vue | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue b/app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue index d3686cfd7..fa9102d59 100644 --- a/app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue +++ b/app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue @@ -188,14 +188,18 @@ const toggle = () => { watch( activeContact, - () => { - if (activeContact.value && props.contactId) { - const contactInboxes = activeContact.value?.contactInboxes || []; + (currentContact, previousContact) => { + if (currentContact && props.contactId) { + // Reset on contact change + if (currentContact?.id !== previousContact?.id) clearSelectedContact(); + // First process the contactable inboxes to get the right structure - const processedInboxes = processContactableInboxes(contactInboxes); + const processedInboxes = processContactableInboxes( + currentContact.contactInboxes || [] + ); // Then Merge processedInboxes with the inboxes list selectedContact.value = { - ...activeContact.value, + ...currentContact, contactInboxes: mergeInboxDetails(processedInboxes, inboxesList.value), }; } diff --git a/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue b/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue index 5540940cd..e3e063740 100644 --- a/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue +++ b/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue @@ -265,7 +265,7 @@ const handleSendWhatsappMessage = async ({ message, templateParams }) => {