mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Media: Prevent type and search attachments filters from short circuiting.
Moves the reference to the source collection out of the props model. If it was translated over to a query (which was potentially possible) which then fired an ajax request, jQuery would attempt to serialize an object recursively, which caused an infinite loop and much sadness for my browser. see #21390. git-svn-id: https://develop.svn.wordpress.org/trunk@22737 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -325,8 +325,9 @@ window.wp = window.wp || {};
|
||||
},
|
||||
|
||||
_changeFilteredProp: function( prop, model, term ) {
|
||||
// Bail if we're currently searching for the same term.
|
||||
if ( this.props.get( prop ) === term )
|
||||
// If this is a query, updating the collection will be handled by
|
||||
// `this._requery()`.
|
||||
if ( this.props.get('query') )
|
||||
return;
|
||||
|
||||
if ( term && ! this.filters[ prop ] )
|
||||
@@ -337,10 +338,10 @@ window.wp = window.wp || {};
|
||||
// If no `Attachments` model is provided to source the searches
|
||||
// from, then automatically generate a source from the existing
|
||||
// models.
|
||||
if ( ! this.props.get('source') )
|
||||
this.props.set( 'source', new Attachments( this.models ) );
|
||||
if ( ! this._source )
|
||||
this._source = new Attachments( this.models );
|
||||
|
||||
this.reset( this.props.get('source').filter( this.validator ) );
|
||||
this.reset( this._source.filter( this.validator, this ) );
|
||||
},
|
||||
|
||||
_changeSearch: function( model, term ) {
|
||||
|
||||
Reference in New Issue
Block a user