Skip to content

Element with prop object containing an element causes maximum call stack error #307

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

Closed
samwalshnz opened this issue Sep 13, 2018 · 3 comments

Comments

@samwalshnz
Copy link
Contributor

import toString from 'react-element-to-jsx-string';

const el = <Element 
	prop={{
		component: <Component />,
	}}
/>

toString(el)

Running the above seems throw the following error:

Uncaught RangeError: Maximum call stack size exceeded
    at Array.sort (:80/native)
    at sortObject (index.js?a730:225)
    at eval (index.js?a730:227)
    at Array.reduce (<anonymous>)
    at sortObject (index.js?a730:225)
    at eval (index.js?a730:227)
    at Array.reduce (<anonymous>)
    at sortObject (index.js?a730:225)
    at eval (index.js?a730:227)
    at Array.reduce (<anonymous>)

Here's a demo: https://stackblitz.com/edit/react-element-to-jsx-string-error?file=index.js

@thomasbertet
Copy link
Contributor

Hi there, just to emphaze a bit this issue, it happened to me too & its quite annoying. Would love to see this in the next release, happy to help test this is you need to.

@samwalshnz
Copy link
Contributor Author

@vvo I hadn't realised how the versioning worked for this repo, and so this PR didn't include an npm version bump. Are we able to retrospectively add one?

@vvo
Copy link
Contributor

vvo commented Oct 9, 2018

@samwalshnz versioning is done at realease time, no need to bump in PRs. Am I missing something else here?

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

No branches or pull requests

3 participants