File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 267267 if ( ! opts . silent && _ . isObject ( newValue ) && isNewValue ) {
268268 var visited = [ ] ;
269269 var checkChanges = function ( obj , prefix ) {
270- // Don't choke on circular references
271- if ( _ . indexOf ( visited , obj ) > - 1 ) {
270+ // Not checking changes on sub-Backbone.Models/Collection props
271+ // 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
272277 return ;
273278 } else {
274279 visited . push ( obj ) ;
You can’t perform that action at this time.
0 commit comments