Make WordPress Core

Ticket #50025: 50025.2.diff

File 50025.2.diff, 2.0 KB (added by adamsilverstein, 4 years ago)
  • src/js/media/models/attachments.js

    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 
    390390                var props;
    391391                if ( this.props.get('query') ) {
    392392                        props = this.props.toJSON();
    393                         props.cache = ( true !== refresh );
    394393                        this.mirror( wp.media.model.Query.get( props ) );
    395394                }
    396395        },
  • src/js/media/models/query.js

    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 */{ 
    213213         * @method
    214214         *
    215215         * @param {object} [props]
    216          * @param {Object} [props.cache=true]   Whether to use the query cache or not.
    217216         * @param {Object} [props.order]
    218217         * @param {Object} [props.orderby]
    219218         * @param {Object} [props.include]
    Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{ 
    243242                        var args     = {},
    244243                                orderby  = Query.orderby,
    245244                                defaults = Query.defaultProps,
    246                                 query,
    247                                 cache    = !! props.cache || _.isUndefined( props.cache );
     245                                query;
    248246
    249247                        // Remove the `query` property. This isn't linked to a query,
    250248                        // this *is* the query.
    251249                        delete props.query;
    252                         delete props.cache;
    253250
    254251                        // Fill default args.
    255252                        _.defaults( props, defaults );
    Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{ 
    288285                        // Substitute exceptions specified in orderby.keymap.
    289286                        args.orderby = orderby.valuemap[ props.orderby ] || props.orderby;
    290287
    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 = [];
    299289
    300290                        // Otherwise, create a new query and add it to the cache.
    301291                        if ( ! query ) {