Add option to limit arrays and objects #104
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There have been issues reported regarding the browser hanging when logging certain objects/arrays #87 #91. After some investigation it seems the size of the objects/arrays is the problem since
console-feed
had to iterate through everything to serialize it and the browser faced trouble when rendering them.I added an option to limit the size of the objects and arrays so that we only serialize the data to a certain point.
I had to also make it transparent that the logged data was truncated and include in the serialized data how many remaining items there are and display the logged data correctly (like the array length).
The implementation is a bit hacky since react-inspector doesn't support limiting and I had to do a few workarounds to render everything.
Example of setting the limit to 10: