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

.deserialize() infinite loop on circular refs. #33

Closed
mlilley opened this issue Nov 14, 2013 · 2 comments
Closed

.deserialize() infinite loop on circular refs. #33

mlilley opened this issue Nov 14, 2013 · 2 comments
Assignees
Milestone

Comments

@mlilley
Copy link

mlilley commented Nov 14, 2013

Syphon.deserialize() doesn't like being fed data with circular references.

I was naively calling .deserialize(form, model.attributes) on a model that was part of a nested hierarchy where parent/children held references to each other as attributes (which is typical of projects using Backbone.Relational). This caused the flattenData() call to infinitely recurse.

Obviously I need to be more careful of what I pass to deserialize, but I scratched my head for a while before realizing the problem. Workaround is simple enough... just _.omit() the offending attributes.

Perhaps a warning note in the readme or source would be a good idea to help others? Currently there's no heads up re circular refs. I doubt implementing detection and handling is worth it, but might also be an alternative solution.

@jamiebuilds
Copy link
Member

@mlilley Thank you for reporting this, sorry it wasn't addressed sooner. Could you possibly provide a code example?

@jamiebuilds
Copy link
Member

I'm convinced implementing circular reference detection is outside the scope of this library. Even if it weren't, I'm not sure what the behavior would be.

However, I think it would be good to add to the documentation. So I'll label this a docs issue.

@jamiebuilds jamiebuilds added this to the v0.5 milestone Jun 26, 2014
@jamiebuilds jamiebuilds self-assigned this Jun 26, 2014
rhubarbselleven added a commit to rhubarbselleven/backbone.syphon that referenced this issue Mar 17, 2015
rhubarbselleven added a commit to rhubarbselleven/backbone.syphon that referenced this issue Mar 17, 2015
rhubarbselleven added a commit to rhubarbselleven/backbone.syphon that referenced this issue Mar 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants