fix(ui): keep trash counter in sync with trash changes
Reload the rail trash count after every operation that changes the trash contents, not just navigation and empty-trash: moving photos to trash (grid, panel, viewer), restoring, permanent delete and deleting an album. Previously the counter stayed stale until the next route change.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import { portal } from '$lib/actions/portal';
|
||||
import { albums } from '$lib/stores/albums.svelte';
|
||||
import { albumActions } from '$lib/stores/album-actions.svelte';
|
||||
import { trash } from '$lib/stores/trash.svelte';
|
||||
|
||||
let title = $state('');
|
||||
let busy = $state(false);
|
||||
@@ -48,6 +49,7 @@
|
||||
try {
|
||||
await albums.destroy(a.id);
|
||||
albumActions.deleting = null;
|
||||
await trash.load();
|
||||
if ($page.params.id === a.id) await goto('/');
|
||||
} catch (e) {
|
||||
error = (e as Error).message;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { auth } from '$lib/stores/auth.svelte';
|
||||
import { albums } from '$lib/stores/albums.svelte';
|
||||
import { transfer } from '$lib/stores/transfer.svelte';
|
||||
import { trash } from '$lib/stores/trash.svelte';
|
||||
import { viewerActions } from '$lib/stores/viewer-actions.svelte';
|
||||
import { buildExifRows, EXIF_BASE, EXIF_CATALOG, EXIF_LABELS } from '$lib/exif';
|
||||
import type { Photo, Preferences, Tag } from '$lib/types';
|
||||
@@ -193,6 +194,7 @@
|
||||
try {
|
||||
await photosApi.deleteBatch([photo.id]);
|
||||
pendingDelete = false;
|
||||
await trash.load();
|
||||
onDeleted?.();
|
||||
} catch {
|
||||
/* ignore */
|
||||
|
||||
Reference in New Issue
Block a user