iachat/app
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
..
actions chore: Avoid contact inboxes getting deleted (#10612) 2024-12-26 16:17:38 +05:30
assets feat: Hide installation identifier (#11722) 2025-06-17 15:45:40 -07:00
builders fix: missing metrics and labels from label summary (#11718) 2025-06-12 17:58:56 +05:30
channels fix: Move contact events to account stream rather than individual user stream (#11082) 2025-03-13 17:46:48 -07:00
controllers feat: OG Image in Chatwoot Help Center (#11826) 2025-07-03 12:41:12 -07:00
dashboards chore: improve plan-based feature handling with plan hierarchy (#11335) 2025-04-28 14:13:56 -07:00
dispatchers feat(ee): Add Captain features (#10665) 2025-01-14 16:15:47 -08:00
drops feat: Add the support for custom attributes in message variables (#8511) 2023-12-08 14:13:35 -08:00
fields chore: improve plan-based feature handling with plan hierarchy (#11335) 2025-04-28 14:13:56 -07:00
finders feat: Add support for search_conversations in copilot (#11520) 2025-05-20 19:22:17 -07:00
helpers feat: OG Image in Chatwoot Help Center (#11826) 2025-07-03 12:41:12 -07:00
javascript fix: Contact name editing did not allow spaces (#11931) 2025-07-14 10:27:50 +05:30
jobs fix: Support location messages in Twilio WhatsApp integration (#11830) 2025-06-30 11:35:32 +05:30
listeners fix: Reply time calculation for re-opened conversations (#11787) 2025-06-27 10:48:07 +05:30
mailboxes chore: upgrade ruby version to 3.4.4 (#11524) 2025-05-21 19:40:07 +05:30
mailers feat: sanitize inbox name (#11597) 2025-06-09 14:46:12 +05:30
models chore: Remove defer attribute from widget-loader script (#11887) 2025-07-08 15:31:33 +05:30
policies feat: Add conversation delete feature (#11677) 2025-06-05 15:53:17 -05:00
presenters feat: hide CSAT survey URLs from agents in dashboard (#11622) 2025-06-11 23:39:47 +05:30
services feat: Add the ability to mention team in private message (#11758) 2025-07-02 19:57:59 +05:30
views chore: Remove defer attribute from widget-loader script (#11887) 2025-07-08 15:31:33 +05:30
workers feat: API Endpoints to update message status (#11387) 2025-04-29 15:33:11 -07:00