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

[TreeView] If not all nodeId`s are different opening an item crashes the browser #10725

Closed
doberkofler opened this issue Oct 19, 2023 · 1 comment
Labels
component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@doberkofler
Copy link

doberkofler commented Oct 19, 2023

Steps to reproduce

https://codesandbox.io/s/jovial-stitch-zn4g9h?file=/src/demo.tsx:99-115

Current behavior

If the TreeView component contains TreeItem components with the same nodeId and an item is opened the browser hangs. Chrome completely hangs and can only be killed and Safari hangs but the window can can be refreshed.

import * as React from "react";
import Paper from "@mui/material/Paper";
import { TreeView } from "@mui/x-tree-view/TreeView";
import { TreeItem } from "@mui/x-tree-view/TreeItem";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";

export default function DataGridProDemo() {
  return (
    <>
      <TreeView
        defaultCollapseIcon={<ExpandMoreIcon />}
        defaultExpandIcon={<ChevronRightIcon />}
      >
        <TreeItem key="1" nodeId="1" label="foo">
          <TreeItem key="2" nodeId="1" label="bar">
            <Paper>Hello World</Paper>
          </TreeItem>
        </TreeItem>
      </TreeView>
    </>
  );
}

Expected behavior

A warning and not to "kill" the browser

Context

Just testing the TreeView component

Your environment

npx @mui/envinfo
System:
    OS: macOS 14.0
  Binaries:
    Node: 20.8.1 - ~/.nvm/versions/node/v20.8.1/bin/node
    npm: 10.2.1 - ~/.nvm/versions/node/v20.8.1/bin/npm
  Browsers:
    Chrome: 118.0.5993.70
    Safari: 17.0

Search keywords: treeview fatal error

@doberkofler doberkofler added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 19, 2023
@flaviendelangle
Copy link
Member

Duplicates #10230

@flaviendelangle flaviendelangle added duplicate This issue or pull request already exists component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants