Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@crabvk

Description

@crabvk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions