iachat/app/javascript/dashboard
Sivin Varghese 661326ae51
fix: Contact name editing did not allow spaces (#11931)
# Pull Request Template

## Description

This PR fixes an issue where editing a contact name from the “Contacts”
tab would not allow spaces in the First or Last Name fields — the space
would disappear immediately after typing.
This issue did not occur in the sidebar editor or when adding a new
contact.



**Cause:** The form had a deep watcher on `contactData`, which triggered
`prepareStateBasedOnProps()` on every nested change. This caused the
form state to reset.

**Solution:** Replaced the deep watcher with a shallow watcher that only
watches `contactData.id`.
This fires once on mount and whenever a new contact is selected,
avoiding unnecessary re-hydration while the user is typing.


Fixes https://github.com/chatwoot/chatwoot/issues/11922 ,
CW-[4623](https://linear.app/chatwoot/issue/CW-4623/inconsistent-name-field-validation-when-editing-contacts-from-contacts)

## Type of change

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

## How Has This Been Tested?

### Screencast


https://github.com/user-attachments/assets/e088f627-d7b1-4d67-85eb-58911ac0c012



## 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-07-14 10:27:50 +05:30
..
api feat: notion OAuth setup (#11765) 2025-06-26 19:16:06 +05:30
assets chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
components fix: Translate Priority and Messages types in Automations and Macros (#11741) 2025-07-08 12:40:40 +05:30
components-next fix: Contact name editing did not allow spaces (#11931) 2025-07-14 10:27:50 +05:30
composables fix: Translate Priority and Messages types in Automations and Macros (#11741) 2025-07-08 12:40:40 +05:30
constants fix: Translate Priority and Messages types in Automations and Macros (#11741) 2025-07-08 12:40:40 +05:30
helper chore: Remove defer attribute from widget-loader script (#11887) 2025-07-08 15:31:33 +05:30
i18n feat: New Assistants Edit Page (#11920) 2025-07-12 17:02:10 +05:30
mixins chore: fix circleci on vite build (#10214) 2024-10-07 15:27:41 +05:30
modules chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
routes feat: New Assistants Edit Page (#11920) 2025-07-12 17:02:10 +05:30
store feat: Voice channel creation Flow (#11775) 2025-06-25 14:21:03 -07:00
App.vue chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
featureFlags.js feat: New Assistants Edit Page (#11920) 2025-07-12 17:02:10 +05:30