mirror of
https://github.com/immich-app/immich.git
synced 2025-01-27 22:22:45 +01:00
fix(web): Reset asset selection when refreshing and changing folder (#15178)
* fix(web): Reset asset selection when refreshing and changing folder * fix: refactor
This commit is contained in:
parent
bab04378dc
commit
cc473c42b5
1 changed files with 9 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { goto, invalidateAll } from '$app/navigation';
|
||||
import { afterNavigate, goto, invalidateAll } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import UserPageLayout, { headerId } from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
|
||||
|
@ -46,8 +46,6 @@
|
|||
let currentPath = $derived($page.url.searchParams.get(QueryParameter.PATH) || '');
|
||||
let currentTreeItems = $derived(currentPath ? data.currentFolders : Object.keys(tree));
|
||||
|
||||
$inspect(data).with(console.log);
|
||||
|
||||
const assetInteraction = new AssetInteraction();
|
||||
|
||||
onMount(async () => {
|
||||
|
@ -66,9 +64,15 @@
|
|||
return url.href;
|
||||
};
|
||||
|
||||
afterNavigate(() => {
|
||||
// Clear the asset selection when we navigate (like going to another folder)
|
||||
cancelMultiselect(assetInteraction);
|
||||
});
|
||||
|
||||
const navigateToView = (path: string) => goto(getLink(path));
|
||||
|
||||
const triggerAssetUpdate = async () => {
|
||||
cancelMultiselect(assetInteraction);
|
||||
await foldersStore.refreshAssetsByPath(data.path);
|
||||
await invalidateAll();
|
||||
};
|
||||
|
@ -91,8 +95,8 @@
|
|||
<CreateSharedLink />
|
||||
<CircleIconButton title={$t('select_all')} icon={mdiSelectAll} onclick={handleSelectAll} />
|
||||
<ButtonContextMenu icon={mdiPlus} title={$t('add_to')}>
|
||||
<AddToAlbum />
|
||||
<AddToAlbum shared />
|
||||
<AddToAlbum onAddToAlbum={() => cancelMultiselect(assetInteraction)} />
|
||||
<AddToAlbum onAddToAlbum={() => cancelMultiselect(assetInteraction)} shared />
|
||||
</ButtonContextMenu>
|
||||
<FavoriteAction removeFavorite={assetInteraction.isAllFavorite} onFavorite={triggerAssetUpdate} />
|
||||
|
||||
|
|
Loading…
Reference in a new issue