iachat/app/javascript/dashboard/store/modules/specs/conversations
Muhsin Keloth 939471cb3b
fix: Prevent duplicate conversations in conversation list (#13713)
Agents using API channel inboxes (e.g., WhatsApp Automate) reported
seeing the same conversation appear twice in their conversation list —
one showing the last message preview and the other showing "No
Messages". Backend investigation confirmed no duplicate conversations
exist in the database, making this purely a frontend issue.

The root cause is a race condition in WebSocket event delivery. When a
conversation is created via the API with auto-assignment, the backend
enqueues multiple ActionCable broadcast jobs (`conversation.created`,
`assignee.changed`, `team.changed`) within milliseconds of each other.
In production with multi-threaded Sidekiq workers, these events can
arrive at the frontend out of order. If `assignee.changed` arrives
before `conversation.created`, the `UPDATE_CONVERSATION` mutation pushes
the conversation into the store (since it doesn't exist yet), and then
`ADD_CONVERSATION` blindly pushes it again — resulting in a duplicate
entry.

The fix adds a uniqueness check in the `ADD_CONVERSATION` mutation to
skip the push if a conversation with the same ID already exists in the
store, matching the dedup pattern already used by
`SET_ALL_CONVERSATION`.
2026-03-06 14:07:02 +04:00
..
actions.spec.js fix: Wrong assignee displayed after switching conversations (#13501) 2026-02-10 15:23:55 +05:30
conversations.fixtures.js fix: Update broken specs (#8651) 2024-01-05 13:09:09 -08:00
getters.spec.js feat: Enforce role permissions on filtered page (#11638) 2025-05-30 15:19:42 +05:30
helpers.spec.js feat: Add a view for unattended conversations (#5890) 2022-11-29 08:18:00 -08:00
mutations.spec.js fix: Prevent duplicate conversations in conversation list (#13713) 2026-03-06 14:07:02 +04:00
testConversationResponse.js feat: Add Advanced Conversation Filters (#3239) 2021-11-18 19:15:02 +05:30