diff --git a/app/javascript/dashboard/components-next/message/MessageMeta.vue b/app/javascript/dashboard/components-next/message/MessageMeta.vue index f26339cbb..7a5a14fe7 100644 --- a/app/javascript/dashboard/components-next/message/MessageMeta.vue +++ b/app/javascript/dashboard/components-next/message/MessageMeta.vue @@ -9,6 +9,21 @@ import { useMessageContext } from './provider.js'; import { MESSAGE_STATUS, MESSAGE_TYPES } from './constants'; +const { + status, + isPrivate, + createdAt, + sourceId, + messageType, + contentAttributes, + inboxId, +} = useMessageContext(); + +// Resolve channel type from the message's own inbox so that the status +// indicator does not depend on `getSelectedChat` being populated. In the +// Agent SDK shell `setActiveChat` runs from a watcher in MessageList and can +// race with the first render of MessageMeta, leaving `currentChat` empty and +// every channel check returning false (the spinner stays forever). const { isAFacebookInbox, isALineChannel, @@ -21,16 +36,7 @@ const { isAnEmailChannel, isAnInstagramChannel, isATiktokChannel, -} = useInbox(); - -const { - status, - isPrivate, - createdAt, - sourceId, - messageType, - contentAttributes, -} = useMessageContext(); +} = useInbox(inboxId.value); const readableTime = computed(() => messageTimestamp(createdAt.value, 'LLL d, h:mm a')