Skip to content

[TreeView] onClick on RichTreeView component is invoked twice #12839

@rgavrilov

Description

@rgavrilov

Order ID or Support key 💳

52426

Search keywords

RichTreeView

Latest version

  • I have tested the latest version

The problem in depth

I have the following code. When I click an item - the console.log statement is executed twice. How do I prevent that?

        <RichTreeView
            items={treeViewItems}
            slots={{ item: TreeItem2 }}
            slotProps={{
                item: {
                    onClick: (e) => {
                        console.log("click");
                    },
                },
            }}
        />

Your environment

`npx @mui/envinfo`

System:
OS: Windows 11 10.0.22631
Binaries:
Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
pnpm: Not Found
Browsers:
Chrome: Not Found
Edge: Chromium (123.0.2420.97)
npmPackages:
@emotion/react: 11.11.4
@emotion/styled: ^11.11.0 => 11.11.0
@mui/base: 5.0.0-beta.40
@mui/core-downloads-tracker: 5.15.15
@mui/icons-material: ^5.15.13 => 5.15.13
@mui/material: ^5.15.13 => 5.15.15
@mui/private-theming: 5.15.14
@mui/styled-engine: 5.15.14
@mui/system: 5.15.15
@mui/types: 7.2.14
@mui/utils: 5.15.14
@mui/x-data-grid: ^6.19.6 => 6.19.6
@mui/x-data-grid-pro: ^6.19.6 => 6.19.6
@mui/x-date-pickers: 6.19.7
@mui/x-date-pickers-pro: ^6.19.7 => 6.19.7
@mui/x-license-pro: ^6.10.2 => 6.10.2
@mui/x-tree-view: ^7.3.0 => 7.3.0
@types/react: ^18.2.64 => 18.2.66
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
typescript: ^5.2.2 => 5.4.2

Metadata

Metadata

Labels

discussionscope: tree viewChanges related to the tree view. This includes TreeView, TreeItem.support: commercialSupport request from paid users.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions