fix(dashboard): preserve old image ids when deleting a product image (#13881)
This commit is contained in:
5
.changeset/eight-zoos-add.md
Normal file
5
.changeset/eight-zoos-add.md
Normal 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
|
||||
.filter((i) => !ids.includes(i.id))
|
||||
.map((i) => ({ url: i.url }))
|
||||
.map((i) => ({ id: i.id, url: i.url }))
|
||||
|
||||
await mutateAsync(
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ export const ProductMediaGallery = ({ product }: ProductMediaGalleryProps) => {
|
||||
const mediaToKeep =
|
||||
product.images
|
||||
?.filter((i) => i.id !== current.id)
|
||||
.map((i) => ({ url: i.url })) || []
|
||||
.map((i) => ({ id: i.id, url: i.url })) || []
|
||||
|
||||
if (curr === media.length - 1) {
|
||||
setCurr((prev) => prev - 1)
|
||||
|
||||
Reference in New Issue
Block a user