iachat/app/javascript/dashboard/store/modules/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 feat: Add Google Translate API Integration (#6454) 2023-02-15 20:50:45 -08:00
helpers fix: country_code should be checked against the contact (#13186) 2026-01-13 14:47:27 +05:30
specs feat: Voice Channel (#11602) 2025-12-19 12:41:33 -08:00
actions.js fix: show upgrade prompt when email transcript returns 402 (#13650) 2026-02-26 12:54:40 +05:30
getters.js feat: Enforce role permissions on filtered page (#11638) 2025-05-30 15:19:42 +05:30
helpers.js feat: Add a priority + created at sort for conversations (#13658) 2026-02-25 18:22:41 -08:00
index.js fix: Prevent duplicate conversations in conversation list (#13713) 2026-03-06 14:07:02 +04:00