From 0e8570bff66ef5438844b63e6a342ef322ac4b97 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Wed, 27 Aug 2025 16:24:18 +0900 Subject: [PATCH] await async ops in removeBlock --- src/replicache/mutations.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/replicache/mutations.ts b/src/replicache/mutations.ts index 9f694201..2978adce 100644 --- a/src/replicache/mutations.ts +++ b/src/replicache/mutations.ts @@ -312,18 +312,18 @@ const removeBlock: Mutation< "block/is-locked", ); if (isLocked?.data.value) continue; - let images = await ctx.scanIndex.eav(block.blockEntity, "block/image"); - ctx.runOnServer(async ({ supabase }) => { - for (let image of images) { + let [image] = await ctx.scanIndex.eav(block.blockEntity, "block/image"); + await ctx.runOnServer(async ({ supabase }) => { + if (image) { let paths = image.data.src.split("/"); await supabase.storage .from("minilink-user-assets") .remove([paths[paths.length - 1]]); } }); - ctx.runOnClient(async () => { + await ctx.runOnClient(async () => { let cache = await caches.open("minilink-user-assets"); - for (let image of images) { + if (image) { await cache.delete(image.data.src + "?local"); } }); -- 2.51.2