-
-
Notifications
You must be signed in to change notification settings - Fork 15
Prevent infinite recursion #5
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
Conversation
@zalmoxisus Do you want to make it a The other issue is |
@blakeembrey, throwing would break the app, but stopping will just not show nested objects in depth, which is not a problem for circular references. So, we could use it for those cases without problems. Not sure, I understand the suggestion about Of course, better to find a solution to catch such cases and ignore as other circular references, but since I don't see one, am coming with this workaround :) |
I think adding a new options object at the end seems reasonable. I was considering doing such a thing in the future to support the idea of restoring circular references too. On throwing, it's fine not too - I just wasn't fully understanding the use-case and figured from a programatic point of view it's better to throw, but from your I'm guessing it's all about the rendering so it's not an issue? Just remember to patch the |
@blakeembrey, ok, thx for the details. I made the changes. Also added the tests and updated the README. Please amend it when you get time. |
Merged with 8401708, cheers! |
For example,
ol3-react-example
has a circular reference, which is not identified, because every reference has a new child. The object can be gotten withstore.getState()
.So it will be like (with i < 1000):
You can copy-paste it to the console to see the structure.
As the result, the recursion is infinite and hang the browser. A simple solution is to have a limit set to
100
.