-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Input fields to have expected behaviour in case of empty / only whitespaces string #6736
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request addresses issues with whitespace handling and empty input validation across various components in the Twenty application. Here's a concise summary of the key changes:
- Implemented
convertToEmptyStringForWhitespaces
utility function to handle whitespace-only inputs - Modified input handling in EmailFieldInput, FullNameFieldInput, and TextFieldInput components
- Updated API key and serverless function creation/editing to prevent empty or whitespace-only names
- Improved WorkspaceInviteTeam component to disable submit button for invalid email inputs
- Enhanced TextInputV2 component to handle whitespace-only inputs consistently
- Added
convertToUndefinedForWhitespaces
utility for converting whitespace to undefined in certain scenarios
These changes collectively prevent the creation of empty objects and improve input validation throughout the application, addressing the issues mentioned in #6734 and #6633.
12 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings
...nt/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
Outdated
Show resolved
Hide resolved
...nt/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
Outdated
Show resolved
Hide resolved
...nt/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
Outdated
Show resolved
Hide resolved
...-front/src/modules/object-record/record-field/meta-types/input/components/TextFieldInput.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
This pull request continues to address issues with whitespace handling and empty input validation across various components in the Twenty application. Here's a summary of the recent changes:
- Modified NumberFieldInput to properly handle empty or whitespace-only inputs, preventing unexpected behavior with null or undefined values.
- Updated FullNameFieldInput to simplify code and improve whitespace handling in name inputs.
- Changed FieldNumberDraftValue type from string to number in FieldInputDraftValue.ts, improving type safety for number fields.
- Implemented NameField component for updating workspace display names, including a check to prevent empty name updates.
- Modified DoubleTextInput and TextInput components to trim whitespace from pasted and input values, addressing issues with empty or whitespace-only content.
- Updated TextAreaInput to use the new
convertToEmptyStringForWhitespaces
utility function for consistent whitespace handling.
These changes further improve input validation and whitespace handling throughout the application, addressing the issues mentioned in #6734, #6633, and #6733.
15 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings
...nt/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
Outdated
Show resolved
Hide resolved
...nt/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
Outdated
Show resolved
Hide resolved
...nt/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
Outdated
Show resolved
Hide resolved
...nt/src/modules/object-record/record-field/meta-types/input/components/FullNameFieldInput.tsx
Outdated
Show resolved
Hide resolved
...-front/src/modules/object-record/record-field/meta-types/input/components/TextFieldInput.tsx
Outdated
Show resolved
Hide resolved
...-front/src/modules/object-record/record-field/meta-types/input/components/TextFieldInput.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx
Show resolved
Hide resolved
@lucasbordeau ready for review. 🚀 |
@charlesBochet solved merge conflicts 🙏🏻 |
Thanks @Nabhag8848 for your contribution! |
ISSUE
Description
Screen.Recording.2024-08-27.at.10.21.21.AM.mov
Screen.Recording.2024-08-30.at.2.57.45.PM.mov
Note: we do have one other issue with FullName field #6740 Inorder to test use shift.
Screen.Recording.2024-08-27.at.10.28.13.AM.mov
Similar to above, Empty webhook endpoint url under /settings/developers/webhooks/new won't be created. Try Entering just spaces
New Functions or Updating Functions will not able to have whitespaces, empty string as Name. Try Entering just spaces
Screen.Recording.2024-08-27.at.10.31.07.AM.mov
Screen.Recording.2024-08-27.at.10.33.18.AM.mov
Screen.Recording.2024-08-30.at.2.47.02.PM.mov
Screen.Recording.2024-08-30.at.2.48.07.PM.mov
Screen.Recording.2024-08-30.at.2.56.26.PM.mov
Pasting fullName is been Improved.
Case 1 (Two Words): If there are exactly two words, return them as is.
Case 2 (More than Two Words): If there are more than two words, return the first two words only.
Case 3 (One Word): If there is only one word, return it as the first name, with an empty string as the last name.
WhiteSpaces have been handled.