-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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:Empty link in record details isn't deleted by default #9840
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 PR adds functionality to handle empty link deletion in record details, ensuring that empty links are properly removed when a user clears the input field.
- Added
isClearingInput
state inMultiItemFieldInput.tsx
to track input clearing status - Modified
handleSubmitInput
to trigger item deletion when input is cleared - Improved empty string validation using
turnIntoEmptyStringIfWhitespacesOnly
utility - Integrated with existing link field components to maintain consistent behavior
1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
...t/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.tsx
Outdated
Show resolved
Hide resolved
...t/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.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.
Hi @Lucifer4255, thank you for your PR.
Your solution is not handling case where input is empty string (without update).
I would handle empty string input in handleSubmitInput
method.
- If inputValue is empty string AND isAddingNewItem, it should early return
- If inputValue is empty string AND !isAddingNewItem, it should delete updated item and early return
6c7d889
to
bdc6481
Compare
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.
@Lucifer4255 thank you for your update, added few comments.
...t/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.tsx
Outdated
Show resolved
Hide resolved
...t/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.tsx
Outdated
Show resolved
Hide resolved
...t/src/modules/object-record/record-field/meta-types/input/components/MultiItemFieldInput.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.
Sounds good to me !
Shouldn't the API reject empty value for objectMetadata field links
? What kind of server side validation do we wanna reach to on objectMetadaItem
fields ?
Log
|
Gives a fix for #9780 . I have added handleDelete inside the submit function and created a state to manage the empty placeholder
Screencast from 2025-01-24 01-45-22.webm