Opened 4 years ago
Closed 4 years ago
#51395 closed defect (bug) (fixed)
The attachment modal is not opened when reloading the page
Reported by: | Mista-Flo | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch dev-feedback |
Focuses: | javascript, administration | Cc: |
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.
Attachments (1)
Change History (5)
#2
@
4 years ago
Thank you @mukesh27,
Just to mention that this is due to the fact that at the refresh, it loads the first 40 attachments (check the AJAX request), so the next attachments are not queried which seems legit.
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.