Skip to content

Commit 9a4915f

Browse files
committed
Fix the issue for number count in media modal
1 parent bf4c174 commit 9a4915f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/js/media/models/attachments.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)