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 }) => {