From aaab2ac788e9613fc8e9213419ca2a5c220312e7 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:58:23 +0530 Subject: [PATCH] fix: Cannot open conversation from contact sidebar. (#10102) Co-authored-by: Muhsin Keloth --- .../routes/dashboard/conversation/ConversationView.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue index 6b321c55d..cb5cfcb5b 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue @@ -15,6 +15,14 @@ export default { PopOverSearch, CmdBarConversationSnooze, }, + beforeRouteLeave(to, from, next) { + // Clear selected state if navigating away from a conversation to a route without a conversationId to prevent stale data issues + // and resolves timing issues during navigation with conversation view and other screens + if (this.conversationId) { + this.$store.dispatch('clearSelectedState'); + } + next(); // Continue with navigation + }, props: { inboxId: { type: [String, Number],