mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.07k stars 1.26k forks source link

[TreeView] Should warn when 2 items have the same ID #10230

Closed ansaganie closed 7 months ago

ansaganie commented 1 year ago

Duplicates

Latest version

Steps to reproduce 🕹

Link to live example:

Steps:

  1. Create TreeItem with same ids
  2. Try to expand

Current behavior 😯

When parent and child TreeItem has same ids for some user error, and tries to expand children sometimes it freezes sometimes it just do not expand

Expected behavior 🤔

Make it crash if there is an id clash between parents and children

Context 🔦

My app constructs tree objects from the data coming from the API. Because of error on backend side, frontend started to receive list of objects with the same ids. So, when User expanding list of objects Tab freezes. It was really hard to find out why it freezes, as I was pretty sure that ids are unique.

Your environment 🌎

npx @mui/envinfo ``` Microsoft Edge Version 111.0.1661.62 (Official build) (64-bit) System: OS: Windows 10 10.0.19045 Binaries: Node: 18.15.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: Not Found Edge: Spartan (44.19041.1266.0), Chromium (111.0.1661.62) npmPackages: @emotion/react: ^11.10.4 => 11.10.4 @emotion/styled: ^11.10.4 => 11.10.4 @mui/base: 5.0.0-alpha.124 @mui/core-downloads-tracker: 5.11.16 @mui/icons-material: ^5.5.0 => 5.8.4 @mui/lab: ^5.0.0-alpha.97 => 5.0.0-alpha.125 @mui/material: ^5.10.8 => 5.11.16 @mui/private-theming: 5.11.13 @mui/styled-engine: 5.11.16 @mui/styles: ^5.5.0 => 5.8.4 @mui/system: 5.11.16 @mui/types: 7.2.3 @mui/utils: 5.11.13 @mui/x-data-grid: ^5.7.0 => 5.12.3 @mui/x-data-grid-generator: ^5.7.0 => 5.12.3 @mui/x-data-grid-premium: 5.12.3 @mui/x-data-grid-pro: 5.12.3 @mui/x-date-pickers: ^5.0.0-alpha.2 => 5.0.0-alpha.7 @mui/x-license-pro: 5.12.3 @types/react: 17.0.43 => 17.0.43 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: 4.8.4 => 4.8.4 ```
siriwatknp commented 1 year ago

We could show the warning in the dev environment.