fix(dashboard): preserve old image ids when deleting a product image (#13881)

This commit is contained in:
Frane Polić authored and GitHub committed 2025-10-28 15:18:36 +01:00
1 parent c1c0e1490a
commit 1594c13962
3 files changed
+7 -2

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): preserve old image ids when deleting a product image
@@ -68,7 +68,7 @@ export const ProductMediaSection = ({ product }: ProductMedisaSectionProps) => {
const mediaToKeep = product.images const mediaToKeep = product.images
.filter((i) => !ids.includes(i.id)) .filter((i) => !ids.includes(i.id))
.map((i) => ({ url: i.url })) .map((i) => ({ id: i.id, url: i.url }))
await mutateAsync( await mutateAsync(
{ {
@@ -90,7 +90,7 @@ export const ProductMediaGallery = ({ product }: ProductMediaGalleryProps) => {
const mediaToKeep = const mediaToKeep =
product.images product.images
?.filter((i) => i.id !== current.id) ?.filter((i) => i.id !== current.id)
.map((i) => ({ url: i.url })) || [] .map((i) => ({ id: i.id, url: i.url })) || []
if (curr === media.length - 1) { if (curr === media.length - 1) {
setCurr((prev) => prev - 1) setCurr((prev) => prev - 1)