I've been using Multiple Post Thumbnails v1.6.5 on a project involving a large media library (1500+ attachments) and have run into a bug where the details frequently fail to populate for a selected attachment when opening the MediaModal. After investigating, I determined that this occurs because a selected attachment is added to the frame's selection, but not explicitly fetched. If the selected attachment is included in the initial query-attachments call(s), details populate. If the attachment is not included, details remain blank until the attachment is loaded via a subsequent call.
This fix takes inspiration from the WordPress featured image uploader by explicitly fetching the selected attachment and then modifying the library's comparator so that a selected attachment shows before any other attachments. I also removed some redundant event handling by specifying multiple: false on frame creation and by adding a selected attachment only on frame open instead of open / activate.
I've been using Multiple Post Thumbnails v1.6.5 on a project involving a large media library (1500+ attachments) and have run into a bug where the details frequently fail to populate for a selected attachment when opening the MediaModal. After investigating, I determined that this occurs because a selected attachment is added to the frame's selection, but not explicitly fetched. If the selected attachment is included in the initial query-attachments call(s), details populate. If the attachment is not included, details remain blank until the attachment is loaded via a subsequent call.
This fix takes inspiration from the WordPress featured image uploader by explicitly fetching the selected attachment and then modifying the library's comparator so that a selected attachment shows before any other attachments. I also removed some redundant event handling by specifying multiple: false on frame creation and by adding a selected attachment only on frame open instead of open / activate.