iachat/app/javascript/dashboard/components-next
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
..
Accordion feat: Allow customizing the responses, flows in Captain (#11385) 2025-04-29 15:42:15 -07:00
avatar chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
banner chore: Update buttons in dashboard (#11145) 2025-03-31 17:21:32 -07:00
breadcrumb feat: New Assistants Edit Page (#11920) 2025-07-12 17:02:10 +05:30
button chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
Campaigns chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
captain feat: New Assistants Edit Page (#11920) 2025-07-12 17:02:10 +05:30
checkbox feat: Add support for bulk action for Captain FAQs (#10905) 2025-02-27 17:05:33 -08:00
colorpicker chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
combobox chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
Contacts fix: Contact name editing did not allow spaces (#11931) 2025-07-14 10:27:50 +05:30
Conversation fix: Style issue with conversation header (#11655) 2025-06-03 15:21:30 +05:30
copilot chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
CustomAttributes feat(v4): Add new contact details screen (#10504) 2024-12-03 21:29:47 -08:00
dialog feat: Add Teleport component to fix RTL/LTR utility classes (#11455) 2025-05-12 11:49:23 -07:00
dropdown-menu chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
Editor chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
feature-spotlight feat: Add support for feature spotlight components (#11012) 2025-03-18 13:17:42 -07:00
filter feat: auto resolve label option and fixes (#11541) 2025-06-04 14:53:24 +05:30
flag feat: Flag icon component (#10564) 2024-12-10 11:53:24 +05:30
HelpCenter chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
icon feat: Voice channel creation Flow (#11775) 2025-06-25 14:21:03 -07:00
Inbox fix: v4 ui issues (#10652) 2025-01-08 18:17:50 +05:30
inline-input chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
input chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
Label chore(v4): Update colors (#10700) 2025-01-16 15:27:23 +05:30
message chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
NewConversation chore: Add cache to improve widget performance (#11163) 2025-03-24 16:04:49 -07:00
pagination chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
phonenumberinput fix: Accidental contact creation on country dropdown toggle (#11494) 2025-05-16 16:14:00 +05:30
selectmenu feat: Update conversation basic filter (#11415) 2025-05-06 12:44:23 +05:30
sidebar chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
spinner feat: Add Spinner to new components (#10303) 2024-10-16 17:53:46 -07:00
switch chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
tabbar chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
taginput feat(v4): Compose a new conversation from a phone number. (#10568) 2024-12-17 18:07:58 +05:30
textarea chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
CardLayout.vue feat: Add support for bulk action for Captain FAQs (#10905) 2025-02-27 17:05:33 -08:00
EmptyStateLayout.vue chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
SidebarActionsHeader.story.vue feat: Update the UI to support the change for Copilot as a universal copilot (#11618) 2025-05-29 12:35:10 +05:30
SidebarActionsHeader.vue feat: Update the UI to support the change for Copilot as a universal copilot (#11618) 2025-05-29 12:35:10 +05:30
TeleportWithDirection.vue feat: Add Teleport component to fix RTL/LTR utility classes (#11455) 2025-05-12 11:49:23 -07:00