diff --git src/js/media/models/attachments.js src/js/media/models/attachments.js
index f80cac42f6..5661df3052 100644
|
|
var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen |
390 | 390 | var props; |
391 | 391 | if ( this.props.get('query') ) { |
392 | 392 | props = this.props.toJSON(); |
393 | | props.cache = ( true !== refresh ); |
394 | 393 | this.mirror( wp.media.model.Query.get( props ) ); |
395 | 394 | } |
396 | 395 | }, |
diff --git src/js/media/models/query.js src/js/media/models/query.js
index 4a6810adf6..c29a638b10 100644
|
|
Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{ |
213 | 213 | * @method |
214 | 214 | * |
215 | 215 | * @param {object} [props] |
216 | | * @param {Object} [props.cache=true] Whether to use the query cache or not. |
217 | 216 | * @param {Object} [props.order] |
218 | 217 | * @param {Object} [props.orderby] |
219 | 218 | * @param {Object} [props.include] |
… |
… |
Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{ |
243 | 242 | var args = {}, |
244 | 243 | orderby = Query.orderby, |
245 | 244 | defaults = Query.defaultProps, |
246 | | query, |
247 | | cache = !! props.cache || _.isUndefined( props.cache ); |
| 245 | query; |
248 | 246 | |
249 | 247 | // Remove the `query` property. This isn't linked to a query, |
250 | 248 | // this *is* the query. |
251 | 249 | delete props.query; |
252 | | delete props.cache; |
253 | 250 | |
254 | 251 | // Fill default args. |
255 | 252 | _.defaults( props, defaults ); |
… |
… |
Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{ |
288 | 285 | // Substitute exceptions specified in orderby.keymap. |
289 | 286 | args.orderby = orderby.valuemap[ props.orderby ] || props.orderby; |
290 | 287 | |
291 | | // Search the query cache for a matching query. |
292 | | if ( cache ) { |
293 | | query = _.find( queries, function( query ) { |
294 | | return _.isEqual( query.args, args ); |
295 | | }); |
296 | | } else { |
297 | | queries = []; |
298 | | } |
| 288 | queries = []; |
299 | 289 | |
300 | 290 | // Otherwise, create a new query and add it to the cache. |
301 | 291 | if ( ! query ) { |