Media: Check if the item is defined before setting the skipHistory property in media frame router.

This avoids a JS error when refreshing the "Attachment details" modal for an item that is not currently queried.

Follow-up to [41021].

Props Mista-Flo, mukesh27.
Fixes #51395.
Built from https://develop.svn.wordpress.org/trunk@49062


git-svn-id: http://core.svn.wordpress.org/trunk@48824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-09-27 08:50:06 +00:00
parent c298458751
commit 6bdbb8b25c
3 changed files with 3 additions and 3 deletions

View File

@ -556,9 +556,9 @@ var Router = Backbone.Router.extend(/** @lends wp.media.view.MediaFrame.Manage.R
// Trigger the media frame to open the correct item. // Trigger the media frame to open the correct item.
item = library.findWhere( { id: parseInt( query, 10 ) } ); item = library.findWhere( { id: parseInt( query, 10 ) } );
item.set( 'skipHistory', true );
if ( item ) { if ( item ) {
item.set( 'skipHistory', true );
frame.trigger( 'edit:attachment', item ); frame.trigger( 'edit:attachment', item );
} else { } else {
item = media.attachment( query ); item = media.attachment( query );

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.6-alpha-49061'; $wp_version = '5.6-alpha-49062';
/** /**
* 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.