redux-devtools icon indicating copy to clipboard operation
redux-devtools copied to clipboard

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

Open arcataroger opened this issue 10 months ago • 1 comments

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

https://github.com/user-attachments/assets/9f7bce8f-33ea-4aeb-9db6-4b6ad8fa2f7c

arcataroger avatar Feb 07 '25 19:02 arcataroger

Potential PR: https://github.com/reduxjs/redux-devtools/pull/1828

arcataroger avatar Feb 07 '25 20:02 arcataroger