react-json-view icon indicating copy to clipboard operation
react-json-view copied to clipboard

shouldCollapse does not work as intended

Open allenl7 opened this issue 4 years ago • 3 comments

i am returning false in many places but it is still showing as collapsed. I know this is not very descriptive. but i wanted to see if this is an issue others are having as well?

allenl7 avatar Jul 28 '21 01:07 allenl7

I just realized shouldCollapse callback is only called for field types array and object. I was doing something expecting all values would go through this callback and maybe you are expecting the same thing.

tbonfim avatar Sep 01 '21 17:09 tbonfim

Yeah it's not working for me either. I'm returning false, and the root node is collapsed. I would like to expand the root node and show the immediate children by default.

timsalesforce avatar Jul 14 '22 20:07 timsalesforce

Ahh, my shouldCollapse() function was async and returned a Promise. I made it synchronous and it works now.

timsalesforce avatar Jul 15 '22 14:07 timsalesforce