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

Add option to limit arrays and objects #105

Merged
merged 1 commit into from
Jun 30, 2022

Conversation

MikeAlOwe-CodeSignal
Copy link
Contributor

@samdenty
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:
Screen Shot 2022-06-17 at 16 42 52

@samdenty samdenty merged commit 19a2c05 into samdenty:master Jun 30, 2022
@MikeAlOwe-CodeSignal
Copy link
Contributor Author

Thank you for merging the PR @samdenty 🙌
Could you also please publish the package with this feature? Would love to move back from my fork!

@samdenty
Copy link
Owner

samdenty commented Jul 1, 2022

Published in 3.4.0 🚀

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 this pull request may close these issues.

2 participants