Skip to content

High performance self-hosted photo and video management solution.

fix(web): Reset asset selection when refreshing and changing folder (#15178)

Arnocc473c42b582
diff --git a/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.svelte
index 900c0a753d..87cd2434d6 100644
--- a/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -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} />