-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
base: main
Are you sure you want to change the base?
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
if (value === '' && itemToEditIndex !== null) { | ||
setIsClearingInput(true); |
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.
logic: comparing with !== null
here is incorrect since itemToEditIndex is a number. Should use !== -1
to match initialization
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.
done
if (isClearingInput && itemToEditIndex !== null) { | ||
handleDeleteItem(itemToEditIndex); |
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.
logic: same issue here with !== null
comparison for itemToEditIndex
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.
Done
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