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

@@ -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)