5180 - does not call debounced update for invalid names (#5181)

fix: #5180 

Previously, clearing your name would kick you to the profile creation
page.


https://github.com/twentyhq/twenty/assets/68029599/8c0087da-6b03-4b6e-b202-eabe8ebcee18


Fixed so it checks your name is valid before calling the debounced
update


https://github.com/twentyhq/twenty/assets/68029599/4bc71d8f-e4f4-49ae-9cb8-497bd971be94

---------

Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
Hinson Chan
2024-04-26 06:23:03 -07:00
committed by GitHub
parent 224c8d361b
commit e1d0b26cf9

View File

@ -84,9 +84,13 @@ export const NameFields = ({
return;
}
const { firstName: currentFirstName, lastName: currentLastName } =
currentWorkspaceMember.name;
if (
currentWorkspaceMember.name?.firstName !== firstName ||
currentWorkspaceMember.name?.lastName !== lastName
(currentFirstName !== firstName || currentLastName !== lastName) &&
firstName !== '' &&
lastName !== ''
) {
debouncedUpdate();
}