Skip to content

Commit 04922ae

Browse files
author
Rajat
committed
deleting block media on block delete
1 parent bcc5233 commit 04922ae

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

apps/web/graphql/pages/logic.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ export const deleteBlock = async ({
502502
return null;
503503
}
504504

505+
const deletedMediaIds = extractMediaIDs(JSON.stringify(block));
506+
for (const mediaId of Array.from(deletedMediaIds)) {
507+
await deleteMedia(mediaId);
508+
}
509+
505510
page.draftLayout = page.draftLayout.filter(
506511
(block: any) => block.widgetId !== blockId,
507512
);

0 commit comments

Comments
 (0)