diff --git a/remix/app/components/ImageVaultDAM.tsx b/remix/app/components/ImageVaultDAM.tsx index c7d90f3..6c1d748 100644 --- a/remix/app/components/ImageVaultDAM.tsx +++ b/remix/app/components/ImageVaultDAM.tsx @@ -136,10 +136,11 @@ export default function ImageVaultDAM({ const handleMedia = useCallback( (result?: InsertResponse) => { - if (field && result) { + if (field) { flushSync(() => { - setMedia(result) - field.setData(result) + setMedia(result || null) + // Data inside the field is supposed to be an empty object if nothing is selected + field.setData(result || {}) document.body.style.overflow = "hidden" }) } @@ -197,14 +198,7 @@ export default function ImageVaultDAM({ {media ? ( - { - setMedia(null) - handleMedia() - }} - onEdit={handleEdit} - /> + ) : ( {