update selection details on change
This commit is contained in:
@@ -769,6 +769,7 @@ const handleFilesUpload = (files: FileList) => {
|
||||
status: "",
|
||||
storage: "",
|
||||
url: "",
|
||||
thumbnail: "",
|
||||
description: "",
|
||||
dimensions: "",
|
||||
variants: {},
|
||||
@@ -987,6 +988,22 @@ watch(page, () => {
|
||||
handleLoad();
|
||||
});
|
||||
|
||||
watch(mediaItems, () => {
|
||||
selected.value = selected.value.map((selectedItem) => {
|
||||
const matchingMediaItem = mediaItems.value.find(
|
||||
(mediaItem) => mediaItem.id === selectedItem.id,
|
||||
);
|
||||
return matchingMediaItem || selectedItem;
|
||||
});
|
||||
|
||||
if (lastSelected.value) {
|
||||
lastSelected.value =
|
||||
mediaItems.value.find(
|
||||
(mediaItem) => mediaItem.id === lastSelected.value.id,
|
||||
) || lastSelected.value;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Determine if the Select button should be disabled
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user