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:
parent
ad7754dbd9
commit
c699cbcf0a
|
@ -1328,13 +1328,11 @@ Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{
|
||||||
var args = {},
|
var args = {},
|
||||||
orderby = Query.orderby,
|
orderby = Query.orderby,
|
||||||
defaults = Query.defaultProps,
|
defaults = Query.defaultProps,
|
||||||
query,
|
query;
|
||||||
cache = !! props.cache || _.isUndefined( props.cache );
|
|
||||||
|
|
||||||
// Remove the `query` property. This isn't linked to a query,
|
// Remove the `query` property. This isn't linked to a query,
|
||||||
// this *is* the query.
|
// this *is* the query.
|
||||||
delete props.query;
|
delete props.query;
|
||||||
delete props.cache;
|
|
||||||
|
|
||||||
// Fill default args.
|
// Fill default args.
|
||||||
_.defaults( props, defaults );
|
_.defaults( props, defaults );
|
||||||
|
@ -1373,14 +1371,7 @@ Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{
|
||||||
// Substitute exceptions specified in orderby.keymap.
|
// Substitute exceptions specified in orderby.keymap.
|
||||||
args.orderby = orderby.valuemap[ props.orderby ] || props.orderby;
|
args.orderby = orderby.valuemap[ props.orderby ] || props.orderby;
|
||||||
|
|
||||||
// Search the query cache for a matching query.
|
queries = [];
|
||||||
if ( cache ) {
|
|
||||||
query = _.find( queries, function( query ) {
|
|
||||||
return _.isEqual( query.args, args );
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
queries = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, create a new query and add it to the cache.
|
// Otherwise, create a new query and add it to the cache.
|
||||||
if ( ! query ) {
|
if ( ! query ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue