Make WordPress Core

Changeset 50067


Ignore:
Timestamp:
01/29/2021 01:34:05 AM (4 years ago)
Author:
antpb
Message:

Media: Remove caching from filter by date in media library.

Previously, newly uploaded media attachments were missing when filtering media items by date due to lack of cache invalidation.

Props adamsilverstein, teamdnk, afercia, Mista-Flo, joedolson, youknowriad, talldanwp.
Fixes #50025.

Location:
trunk/src/js/media/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/media/models/attachments.js

    r48989 r50067  
    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        }
  • trunk/src/js/media/models/query.js

    r50029 r50067  
    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]
     
    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.
     
    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.
Note: See TracChangeset for help on using the changeset viewer.