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.
Fixes #50025.

Built from https://develop.svn.wordpress.org/trunk@50021


git-svn-id: http://core.svn.wordpress.org/trunk@49722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2021-01-26 05:26:01 +00:00
parent ad7754dbd9
commit c699cbcf0a
3 changed files with 4 additions and 13 deletions

View File

@ -1328,13 +1328,11 @@ Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{
var args = {},
orderby = Query.orderby,
defaults = Query.defaultProps,
query,
cache = !! props.cache || _.isUndefined( props.cache );
query;
// Remove the `query` property. This isn't linked to a query,
// this *is* the query.
delete props.query;
delete props.cache;
// Fill default args.
_.defaults( props, defaults );
@ -1373,14 +1371,7 @@ Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{
// Substitute exceptions specified in orderby.keymap.
args.orderby = orderby.valuemap[ props.orderby ] || props.orderby;
// Search the query cache for a matching query.
if ( cache ) {
query = _.find( queries, function( query ) {
return _.isEqual( query.args, args );
});
} else {
queries = [];
}
queries = [];
// Otherwise, create a new query and add it to the cache.
if ( ! query ) {

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-alpha-50017';
$wp_version = '5.7-alpha-50021';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.