1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-21 03:02:44 +01:00

fix(web): navigate to album from search (#5241)

This commit is contained in:
Jason Rasmussen 2023-11-22 10:54:58 -05:00 committed by GitHub
parent 106bae4a31
commit 309ba7d67e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -7,6 +7,7 @@
import { flip } from 'svelte/animate'; import { flip } from 'svelte/animate';
import { getThumbnailSize } from '$lib/utils/thumbnail-util'; import { getThumbnailSize } from '$lib/utils/thumbnail-util';
import { assetViewingStore } from '$lib/stores/asset-viewing.store'; import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import { onDestroy } from 'svelte';
export let assets: AssetResponseDto[]; export let assets: AssetResponseDto[];
export let selectedAssets: Set<AssetResponseDto> = new Set(); export let selectedAssets: Set<AssetResponseDto> = new Set();
@ -80,6 +81,10 @@
$showAssetViewer = false; $showAssetViewer = false;
history.pushState(null, '', `${$page.url.pathname}`); history.pushState(null, '', `${$page.url.pathname}`);
}; };
onDestroy(() => {
$showAssetViewer = false;
});
</script> </script>
{#if assets.length > 0} {#if assets.length > 0}

View file

@ -121,7 +121,7 @@
afterNavigate(({ from }) => { afterNavigate(({ from }) => {
assetViewingStore.showAssetViewer(false); assetViewingStore.showAssetViewer(false);
let url: string | undefined = from?.url.pathname; let url: string | undefined = from?.url?.pathname;
if (from?.route.id === '/(user)/search') { if (from?.route.id === '/(user)/search') {
url = from.url.href; url = from.url.href;

View file

@ -70,7 +70,7 @@
afterNavigate(({ from }) => { afterNavigate(({ from }) => {
// Prevent setting previousRoute to the current page. // Prevent setting previousRoute to the current page.
if (from && from.route.id !== $page.route.id) { if (from?.url && from.route.id !== $page.route.id) {
previousRoute = from.url.href; previousRoute = from.url.href;
} }
@ -145,7 +145,7 @@
</section> </section>
{/if} {/if}
<section id="search-content" class="relative bg-immich-bg dark:bg-immich-dark-bg"> <section id="search-content" class="relative bg-immich-bg dark:bg-immich-dark-bg">
{#if data.results?.assets?.items.length > 0} {#if searchResultAssets.length > 0}
<div class="pl-4"> <div class="pl-4">
<GalleryViewer assets={searchResultAssets} bind:selectedAssets showArchiveIcon={true} /> <GalleryViewer assets={searchResultAssets} bind:selectedAssets showArchiveIcon={true} />
</div> </div>