revert evictFromCache, add back delay + marks invalidation

Remove evictFromCache entirely - the cache-manipulation approach was
brittle and broke both archive (photos not removed) and tags
(colors/ratings showing empty). Replace with: 200ms delay before
invalidation to let PhotoPrism's indexer process the change, plus
invalidateQueries(['marks']) so tag caches (colors, ratings, notes)
refresh alongside the photo timeline.
This commit is contained in:
2026-06-07 22:31:39 +02:00
parent 82f2a40269
commit 73c36b4817
5 changed files with 14 additions and 45 deletions

View File

@@ -14,7 +14,6 @@
} from '$lib/services/photoprism';
import { batchEdit } from '$lib/services/batch';
import { acceptDateAndKeep, cachedPhoto } from '$lib/services/photoActions';
import { evictFromCache } from '$lib/services/bulk';
import { suggestDateFromPath } from '$lib/utils/suggestDateFromPath';
import { photoNameAndDir } from '$lib/types/photoprism';
import {
@@ -130,6 +129,7 @@
const result = await fn();
if (bulk) {
doneBulk(bulk.doneLabel, bulk.ids);
await delay(200);
}
return result;
} catch (e) {
@@ -138,6 +138,8 @@
} finally {
busy = false;
void qc.invalidateQueries({ queryKey: ['photos'] });
void qc.invalidateQueries({ queryKey: ['marks'] });
void qc.invalidateQueries({ queryKey: ['review-groups'] });
}
}
@@ -152,7 +154,6 @@
setDetail(p?.FileName ?? completedId);
}
});
evictFromCache(ids);
if (errors.length) {
toast.error(`Kept ${updated.length}; ${errors.length} failed`, { id: tid });
} else {
@@ -180,7 +181,6 @@
await withBusy(async () => {
try {
await batchArchive(ids);
evictFromCache(ids);
pushUndo(`Archived ${ids.length}`, async () => {
await batchRestore(ids);
void qc.invalidateQueries({ queryKey: ['photos'] });
@@ -206,7 +206,6 @@
await withBusy(async () => {
try {
await batchDelete(ids);
evictFromCache(ids);
focusAfter(ids);
clearSelection();
toast.success(`Deleted ${ids.length}`, { id: tid });
@@ -223,7 +222,6 @@
await withBusy(async () => {
try {
await batchRestore(ids);
evictFromCache(ids);
pushUndo(`Restored ${ids.length}`, async () => {
await batchArchive(ids);
void qc.invalidateQueries({ queryKey: ['photos'] });