We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b35e22e commit cc6e2b8Copy full SHA for cc6e2b8
1 file changed
backbone-nested.js
@@ -267,8 +267,13 @@
267
if (!opts.silent && _.isObject(newValue) && isNewValue){
268
var visited = [];
269
var checkChanges = function(obj, prefix) {
270
- // Don't choke on circular references
271
- 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
272
+ // (typically, Backbone.Models have _events properties which may have lots of things inside it, and
273
+ // we should not put useless observers on it)
274
+ if(obj instanceof Backbone.Model || obj instanceof Backbone.Collection) {
275
+ return;
276
+ } else if(_.indexOf(visited, obj) > -1) { // Don't choke on circular references
277
return;
278
} else {
279
visited.push(obj);
0 commit comments