We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1cab0dc commit f2cf6c9Copy full SHA for f2cf6c9
1 file changed
backbone-nested.js
@@ -274,8 +274,13 @@
274
if (!opts.silent && _.isObject(newValue) && isNewValue){
275
var visited = [];
276
var checkChanges = function(obj, prefix) {
277
- // Don't choke on circular references
278
- if(_.indexOf(visited, obj) > -1) {
+ // Not checking changes on sub-Backbone.Models/Collection props
+ // in order to avoid to put observers on potential heavy objects
279
+ // (typically, Backbone.Models have _events properties which may have lots of things inside it, and
280
+ // we should not put useless observers on it)
281
+ if(obj instanceof Backbone.Model || obj instanceof Backbone.Collection) {
282
+ return;
283
+ } else if(_.indexOf(visited, obj) > -1) { // Don't choke on circular references
284
return;
285
} else {
286
visited.push(obj);
0 commit comments