You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: