Skip to content

fix(frontend): prevent command menu reopening when clicking the same field #12390

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

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

Conversation

omarNaifer12
Copy link
Contributor

@omarNaifer12 omarNaifer12 commented May 30, 2025

ressolve #12205
This PR fixes the issue where the record in the command menu was reopening when clicking the same field again.
https://github.com/user-attachments/assets/52da7b3f-4704-4a9c-8fc4-29534568b0c0

  • Added recordId to cells so it can be accessed when useListenClickOutside is triggered, and compared the previous recordId with the new one to prevent closing the command menu for the same record.

  • When the field is clicked, we compare the lastRecordId with the new recordId inside the openRecordInCommandMenu function to avoid reopening the menu unnecessarily.

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

Implements a fix to prevent command menu from reopening when clicking the same record field, reducing unnecessary re-renders and scroll resets.

  • Added early return in useOpenRecordInCommandMenu by comparing lastRecordId with new recordId
  • Added data-record-id attribute to non-readonly cells in RecordTableCellBaseContainer
  • Enhanced useListenClickOutside to check record IDs in clicked element's parent chain
  • Improved click handling by preventing command menu closure when clicking within the same record

💡 (4/5) You can add custom instructions or style guidelines for the bot here!

3 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +101 to +103
if (currentDataAttributes?.recordId === lastRecordId) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Early return here could prevent other necessary click-outside behaviors. Consider moving this check to after other critical validations

Copy link
Contributor

github-actions bot commented May 30, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:2393

This environment will automatically shut down when the PR is closed or after 5 hours.

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

Successfully merging this pull request may close these issues.

1 participant