fix(web): delete action closes asset viewer in asset view (#15469)

fixes #14647
This commit is contained in:
Alessandro Baroni
2025-03-03 19:24:37 +01:00
committed by GitHub
parent e2c34f17ba
commit f89e74181b
5 changed files with 22 additions and 9 deletions
@@ -19,3 +19,4 @@ export type Action = {
[K in AssetAction]: { type: K } & ActionMap[K];
}[AssetAction];
export type OnAction = (action: Action) => void;
export type PreAction = (action: Action) => void;
@@ -14,14 +14,15 @@
import { deleteAssets, type AssetResponseDto } from '@immich/sdk';
import { mdiDeleteForeverOutline, mdiDeleteOutline } from '@mdi/js';
import { t } from 'svelte-i18n';
import type { OnAction } from './action';
import type { OnAction, PreAction } from './action';
interface Props {
asset: AssetResponseDto;
onAction: OnAction;
preAction: PreAction;
}
let { asset, onAction }: Props = $props();
let { asset, onAction, preAction }: Props = $props();
let showConfirmModal = $state(false);
@@ -41,6 +42,7 @@
const trashAsset = async () => {
try {
preAction({ type: AssetAction.TRASH, asset });
await deleteAssets({ assetBulkDeleteDto: { ids: [asset.id] } });
onAction({ type: AssetAction.TRASH, asset });