Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/js/media/models/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen
this.observers.push( attachments );

attachments.on( 'add change remove', this._validateHandler, this );
attachments.on( 'add', this._addToTotalAttachments, this );
attachments.on( 'remove', this._removeFromTotalAttachments, this );
attachments.on( 'reset', this._validateAllHandler, this );
this.validateAll( attachments );
return this;
Expand Down Expand Up @@ -310,6 +308,11 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen
this.reset( [], { silent: true } );
this.observe( attachments );

// Bind total attachment count tracking only to the mirrored query
// collection, not to additional observed collections (e.g. selection).
attachments.on( 'add', this._addToTotalAttachments, this );
attachments.on( 'remove', this._removeFromTotalAttachments, this );

// Used for the search results.
this.trigger( 'attachments:received', this );
return this;
Expand Down
Loading