Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Lucifer4255
Copy link
Contributor

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

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 in MultiItemFieldInput.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

Comment on lines 86 to 87
if (value === '' && itemToEditIndex !== null) {
setIsClearingInput(true);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 138 to 139
if (isClearingInput && itemToEditIndex !== null) {
handleDeleteItem(itemToEditIndex);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants