tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
298
fork
atom
a tool for shared writing and social publishing
298
fork
atom
overview
issues
31
pulls
3
pipelines
await async ops in removeBlock
awarm.space
7 months ago
0e8570bf
6bd1f9cc
+5
-5
1 changed file
expand all
collapse all
unified
split
src
replicache
mutations.ts
+5
-5
src/replicache/mutations.ts
reviewed
···
312
312
"block/is-locked",
313
313
);
314
314
if (isLocked?.data.value) continue;
315
315
-
let images = await ctx.scanIndex.eav(block.blockEntity, "block/image");
316
316
-
ctx.runOnServer(async ({ supabase }) => {
317
317
-
for (let image of images) {
315
315
+
let [image] = await ctx.scanIndex.eav(block.blockEntity, "block/image");
316
316
+
await ctx.runOnServer(async ({ supabase }) => {
317
317
+
if (image) {
318
318
let paths = image.data.src.split("/");
319
319
await supabase.storage
320
320
.from("minilink-user-assets")
321
321
.remove([paths[paths.length - 1]]);
322
322
}
323
323
});
324
324
-
ctx.runOnClient(async () => {
324
324
+
await ctx.runOnClient(async () => {
325
325
let cache = await caches.open("minilink-user-assets");
326
326
-
for (let image of images) {
326
326
+
if (image) {
327
327
await cache.delete(image.data.src + "?local");
328
328
}
329
329
});