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

Menu with multiple targets triggers re-render of all the targets #162

Open
crabvk opened this issue May 13, 2024 · 1 comment
Open

Menu with multiple targets triggers re-render of all the targets #162

crabvk opened this issue May 13, 2024 · 1 comment

Comments

@crabvk
Copy link

crabvk commented May 13, 2024

Describe the bug
I have a large list of items, each item with its own state. So, I have the Item component with code like this:

function Item() {
  const { showContextMenu } = useContextMenu()

  return (
    <div
      onContextMenu={showContextMenu([
        {
          key: 'action',
          onClick: () => alert('action'),
        },
      ])}
    >
      Test
    </div>
  )
}

When I click the right mouse button on one of the items, the whole list (each item) re-renders.

Expected behavior
Only the clicked item re-renders.

Desktop (please complete the following information):

  • OS: Artix Linux 6.8.7
  • Browser: Firefox Developer Edition 126.0b9
  • Mantine: 7.8.1
@icflorescu
Copy link
Owner

Unfortunately I cannot deal with this at the moment, but I'm more than open to a PR addressing the issue!

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

No branches or pull requests

2 participants