[wp-trac] [WordPress Trac] #51395: The attachment modal is not opened when reloading the page
WordPress Trac
noreply at wordpress.org
Fri Sep 25 18:41:26 UTC 2020
#51395: The attachment modal is not opened when reloading the page
--------------------------+-----------------------------
Reporter: Mista-Flo | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Keywords: has-patch
Focuses: javascript |
--------------------------+-----------------------------
Hello,
On the media library page, grid mode, if you click on an attachment, it
will open a modal. If you refresh the page, the modal will be opened again
on the same attachment.
But if you have more than 40 attachments in the page, if you click on the
41st attachment, the modal is opened as expected, but if you refresh the
page, you have a console error (Uncaught TypeError: Cannot read property
'set' of undefined) in a JS file and the modal is not opened.
This is due because the code calls `item.set( 'skipHistory', true );` in
`src/js/media/routers/manage.js` despite it's not sure the item has been
found.
So when moving this line after being sure the item is defined, the error
is gone and the modal can be opened without a problem.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51395>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list