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

react-json-tree crashes on sparse array with 51+ elements #1827

Open
arcataroger opened this issue Feb 7, 2025 · 1 comment · May be fixed by #1828
Open

react-json-tree crashes on sparse array with 51+ elements #1827

arcataroger opened this issue Feb 7, 2025 · 1 comment · May be fixed by #1828

Comments

@arcataroger
Copy link

arcataroger commented Feb 7, 2025

If you try to show a sparse array with 51 or more elements, JSONTree crashes with Cannot read properties of undefined (reading 'to') from isRange()

This happens any time a sparse array has more than collectionLimit items, which is 50 by default.

let sparseArrayBroken: string[] = [];
sparseArrayBroken[50] = "this causes a crash";
<JSONTree data={sparseArrayBroken} />

Reproduction here: https://codesandbox.io/p/sandbox/ns6q5j

Screenshot.001018.mp4
@arcataroger
Copy link
Author

Potential PR: #1828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant