chatwoot/app/javascript/dashboard
Sivin Varghese 6b767dbe94
fix: Duplicate attachments when navigating back to a conversation (#11472)
# Pull Request Template

## Description

Fixes
[CW-4330](https://linear.app/chatwoot/issue/CW-4330/bug-attachments-in-gallery-view-gets-duplicated-when-you-navigate-back)

**Cause**
When navigating back to a previously viewed conversation, attachments
were being duplicated in the Gallery View. This occurred because the
`SET_ALL_ATTACHMENTS` mutation was appending new attachments to existing
ones `(attachments.push(...data))` instead of replacing them. Each time
a user returned to a conversation, the attachment list would grow,
showing duplicate images.

**Solution**
Updated the `SET_ALL_ATTACHMENTS` mutation to replace the entire
attachments array instead of appending to it. This change ensures
attachments are cleared before adding new ones when returning to a
previously viewed conversation, preventing duplicates.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

### Loom video

https://www.loom.com/share/b2472c07e95843f6879724b19ef89311?sid=eed42238-b4bc-4dbe-8ede-a25a13b4610d

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2025-05-14 15:40:11 -07:00
..
api feat: Allow customizing the responses, flows in Captain (#11385) 2025-04-29 15:42:15 -07:00
assets chore: Update date range picker with new theme colors (#11267) 2025-04-09 16:03:53 +05:30
components feat: Add Teleport component to fix RTL/LTR utility classes (#11455) 2025-05-12 11:49:23 -07:00
components-next feat: Add Teleport component to fix RTL/LTR utility classes (#11455) 2025-05-12 11:49:23 -07:00
composables feat: Add support for minutes in auto resolve feature (#11269) 2025-05-07 00:36:15 -07:00
constants feat: Add visibility checks for installation types (#10773) 2025-02-21 14:48:31 -08:00
helper fix: Add missing 'hc' path segment after custom domain in article URLs (#11353) 2025-04-22 21:53:50 +05:30
i18n chore: Update translations (#11458) 2025-05-10 19:21:34 -07:00
mixins chore: fix circleci on vite build (#10214) 2024-10-07 15:27:41 +05:30
modules chore: Update buttons in dashboard (#11145) 2025-03-31 17:21:32 -07:00
routes feat: Add support for typing events in webhooks (#11423) 2025-05-08 17:28:35 -07:00
store fix: Duplicate attachments when navigating back to a conversation (#11472) 2025-05-14 15:40:11 -07:00
App.vue feat: Upgrade page instead of banner (#11202) 2025-03-28 02:28:17 -07:00
featureFlags.js feat: Instagram Inbox using Instagram Business Login (#11054) 2025-04-08 10:47:41 +05:30