Closed ajmeese7 closed 4 months ago
Hey @ajmeese7
Not sure how you got that circular structure error to show up (it is not showing for me).
As for your code: You are using the RichTreeView
component, so you don't need to render actual React Elements.
Try this instead:
const treeItems = [
{
id: '1',
label: 'Item 1',
children: [
{ id: '1-1', label: 'Item 1-1' },
{ id: '1-2', label: 'Item 1-2' },
],
},
{
id: '2',
label: 'Item 2',
children: [{ id: '2-1', label: 'Item 2-1' }],
},
{ id: '3', label: 'Item 3' },
];
// Ensure the tree items are defined within the context of RichTreeView
const GeoLocationDistributionTree = () => {
return (
<div style={{ marginTop: '10px' }}>
<RichTreeView
slots={{
collapseIcon: ExpandMoreIcon,
expandIcon: ChevronRightIcon,
}}
items={treeItems}
/>
</div>
);
};
Your suggestion works! Thank you, closing this out now.
:warning: This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@ajmeese7: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.
Steps to reproduce
Can be seen live here: https://playcode.io/1916318
Current behavior
Expected behavior
It should work as expected. I removed all of the custom logic I had in my component and stripped it down to the barebones in case the error was caused by my objects, but it is still able to be reproduced by this simple static section of code.
Context
I might be an idiot who's doing something completely wrong, if so I apologize in advance and humbly request that you correct the error of my ways.
Your environment
``` System: OS: Linux 6.5 Zorin OS 17.1 17.1 Binaries: Node: 18.20.3 - ~/.nvm/versions/node/v18.20.3/bin/node npm: 10.8.1 - ~/.nvm/versions/node/v18.20.3/bin/npm pnpm: 9.1.1 - ~/.local/share/pnpm/pnpm Browsers: Chrome: Not Found npmPackages: @emotion/react: ^11.11.4 => 11.11.4 @emotion/styled: ^11.11.5 => 11.11.5 @mui/base: 5.0.0-beta.40 @mui/core-downloads-tracker: 5.15.20 @mui/icons-material: ^5.15.20 => 5.15.20 @mui/material: ^5.15.20 => 5.15.20 @mui/private-theming: 5.15.20 @mui/styled-engine: 5.15.14 @mui/styled-engine-sc: ^6.0.0-alpha.27 => 6.0.0-dev.20240529-082515-213b5e33ab @mui/system: 5.15.20 @mui/types: 7.2.14 @mui/utils: 5.15.20 @mui/x-tree-view: ^7.7.1 => 7.7.1 @types/react: ^18.2.0 => 18.2.78 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 styled-components: ^6.1.8 => 6.1.8 typescript: ^4.9.5 => 4.9.5 ``` Using Brave Browser v1.67.119.npx @mui/envinfo
Search keywords: circular, structure, json