perf: evict archived/deleted photos from cache immediately

Remove archived/restored/deleted/approved UIDs from all cached photo-list
pages right after the API confirms, so the grid updates on the same tick
instead of waiting for a network round-trip. Also removes the 400ms
doneBulk animation delay (now unnecessary since tiles vanish instantly).
This commit is contained in:
2026-06-07 21:53:16 +02:00
parent 5da1022ed1
commit 1df16a6142
5 changed files with 41 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
import { toast } from 'svelte-sonner';
import { batchEdit } from '$lib/services/batch';
import { invalidatePhotos } from '$lib/services/bulk';
import { invalidatePhotos, evictFromCache } from '$lib/services/bulk';
import {
addToHeap,
approvePhoto,
@@ -194,6 +194,7 @@ export function gridKeyNav(node: HTMLElement, params: GridKeyNavParams = {}) {
return;
}
doneBulk(doneLabel, ids);
evictFromCache(ids);
focusAfter(ids);
clearSelection();
invalidatePhotos(ids);
@@ -233,6 +234,7 @@ export function gridKeyNav(node: HTMLElement, params: GridKeyNavParams = {}) {
return;
}
doneBulk(`Deleted ${ids.length}`, ids);
evictFromCache(ids);
focusAfter(ids);
clearSelection();
invalidatePhotos(ids);
@@ -270,6 +272,7 @@ export function gridKeyNav(node: HTMLElement, params: GridKeyNavParams = {}) {
doneBulk(`Kept ${ids.length}`, ids);
toast.success(`Kept ${ids.length}`, { id: tid });
}
evictFromCache(ids);
focusAfter(ids);
clearSelection();
invalidatePhotos(ids);