File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -212,8 +212,6 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen
212212 this . observers . push ( attachments ) ;
213213
214214 attachments . on ( 'add change remove' , this . _validateHandler , this ) ;
215- attachments . on ( 'add' , this . _addToTotalAttachments , this ) ;
216- attachments . on ( 'remove' , this . _removeFromTotalAttachments , this ) ;
217215 attachments . on ( 'reset' , this . _validateAllHandler , this ) ;
218216 this . validateAll ( attachments ) ;
219217 return this ;
@@ -310,6 +308,11 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen
310308 this . reset ( [ ] , { silent : true } ) ;
311309 this . observe ( attachments ) ;
312310
311+ // Bind total attachment count tracking only to the mirrored query
312+ // collection, not to additional observed collections (e.g. selection).
313+ attachments . on ( 'add' , this . _addToTotalAttachments , this ) ;
314+ attachments . on ( 'remove' , this . _removeFromTotalAttachments , this ) ;
315+
313316 // Used for the search results.
314317 this . trigger ( 'attachments:received' , this ) ;
315318 return this ;
You can’t perform that action at this time.
0 commit comments