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

@@ -13,7 +13,7 @@
import { toast } from 'svelte-sonner';
import { batchEdit } from './batch';
import { invalidatePhotos } from './bulk';
import { invalidatePhotos, evictFromCache } from './bulk';
import {
approvePhoto,
batchArchive,
@@ -68,6 +68,7 @@ export async function dismissPhotos(uids: string[]): Promise<void> {
if (uids.length === 0) return;
const tid = toast.loading(`Dismissing ${uids.length}`);
const { updated, errors } = await batchEdit(uids, (id) => approvePhoto(id));
evictFromCache(uids);
focusAfter(uids);
clearSelection();
invalidatePhotos(uids);
@@ -107,6 +108,7 @@ export async function acceptDateAndKeep(uids: string[]): Promise<void> {
await approvePhoto(id);
return id;
});
evictFromCache(uids);
focusAfter(uids);
clearSelection();
invalidatePhotos(uids);
@@ -133,6 +135,7 @@ export async function archivePhotos(uids: string[]): Promise<void> {
toast.error(err instanceof Error ? err.message : 'Archive failed', { id: tid });
return;
}
evictFromCache(uids);
pushUndo(`Archived ${uids.length}`, async () => {
await batchRestore(uids);
invalidatePhotos(uids);