Opened 6 years ago
Closed 6 years ago
#51395 closed defect (bug) (fixed)
The attachment modal is not opened when reloading the page
| Reported by: | Mista-Flo | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.6 |
| Component: | Media | Version: | |
| Severity: | normal | Keywords: | has-patch dev-feedback |
| Cc: | Focuses: | javascript, administration |
Description
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi there,
I have replicated the issue and 51395.1.patch patch working fine for WordPress version 5.6-alpha-48958.
Added dev-feedback for dev feedback.