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
Following is a test case that proves the equality in a minimalistic case:
constChild=Backbone.RelationalModel.extend();constChildren=Backbone.Collection.extend({model: Child});constParent=Backbone.RelationalModel.extend({relations: [{type: Backbone.HasMany,key: 'children',relatedModel: Child,relatedCollection: Children}]});constparent1=newParent({id: 'parent1',children: [{id: 'child1'}]});constparent2=newParent({id: 'parent2',children: [{id: 'child2'}]});// This is how it is, though not really expected.expect(parent1.get('children').options).to.equal(parent2.get('children').options);
Potential cause
In the following snippet, collectionOptions gets assigned an empty object, once when loading the library.
Minimal case showing the problem
Following is a test case that proves the equality in a minimalistic case:
Potential cause
In the following snippet,
collectionOptions
gets assigned an empty object, once when loading the library.Backbone-relational/backbone-relational.js
Lines 932 to 942 in 1ee7dc0
That object is then reused and passed (in the case it is not a function) as options when instantiating a new collection.
Backbone-relational/backbone-relational.js
Lines 967 to 977 in 1ee7dc0
This most likely leads to instances of collections sharing a reference to the very same
this.options
object.The text was updated successfully, but these errors were encountered: