You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting this error Uncaught RangeError: Maximum call stack size exceeded when trying to prettify large input strings on chrome (and some versions of firefox)
Thank you for taking the time to create a bug report.
The short answer is that this library is just a thin wrapper over a parser combinator library designed for generic document layout into a fixed width terminal. It is gratuitously recursive when generating its internal AST.
Because we only care about JSON, and we probably don't really care about tight width guarantees (JSON does not support folding whitespace inside literals), a more naive stringify implementation custom written for JSON is almost certainly a better fit.
My reasoning for the current implementation was to have small arrays or maps combined on one line. That was aesthetically please to me personally because long lists of numbers would not expand into many line monstrosity. Looking at what this library does today, it appears that behavior was lost sometime ago during the implementation and I did not notice.
In my view there are two bugs in this report:
Perfectly reasonably sized JSON causes Maximum call stack error (I was expecting megabytes, not a few kilobytes).
Arrays are not rendered compactly.
Action
I will find where the callstack gets deep. (Hopefully it is in the layout code and not the AST generation. I can always speed up recursive layout code by modifying it to be tail recursive). I can always temporarily bugfix with a naive formatter that replicates the existing output, and continue to work on my preferred formatting.
I will update you by end of day tomorrow what I have found and what my plan is.
I am getting this error
Uncaught RangeError: Maximum call stack size exceeded
when trying to prettify large input strings on chrome (and some versions of firefox)You can see the error here:
https://ellie-app.com/3qgxLtypPdZa1
Switching to the pretty function (commented in the ellie) from the package emilianobovetti/elm-yajson seems to work even for very large input.
The text was updated successfully, but these errors were encountered: