diff --git a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte index 098d4044de..e4fe7adc4d 100644 --- a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte +++ b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte @@ -9,6 +9,7 @@ export let assets: AssetResponseDto[]; export let sharedLink: SharedLinkResponseDto | undefined = undefined; export let selectedAssets: Set = new Set(); + export let disableAssetSelect = false; let isShowAssetViewer = false; @@ -96,6 +97,7 @@ (isMultiSelectionMode ? selectAssetHandler(e) : viewAssetHandler(e))} diff --git a/web/src/lib/components/shared-components/search-bar/search-bar.svelte b/web/src/lib/components/shared-components/search-bar/search-bar.svelte index 70f553ea2f..8f682b429b 100644 --- a/web/src/lib/components/shared-components/search-bar/search-bar.svelte +++ b/web/src/lib/components/shared-components/search-bar/search-bar.svelte @@ -8,10 +8,6 @@ export let value = ''; export let grayTheme: boolean; - // Replace state to immediately go back to previous page, instead - // of having to go through every search query. - export let replaceHistoryState = false; - let showBigSearchBar = false; $: showClearIcon = value.length > 0; @@ -33,7 +29,7 @@ clip: clipSearch }); - goto(`${AppRoute.SEARCH}?${params}`, { replaceState: replaceHistoryState }); + goto(`${AppRoute.SEARCH}?${params}`); } const saveSearchTerm = (saveValue: string) => { diff --git a/web/src/routes/(user)/search/+page.svelte b/web/src/routes/(user)/search/+page.svelte index 8d8b53ee7c..1cfdf225d7 100644 --- a/web/src/routes/(user)/search/+page.svelte +++ b/web/src/routes/(user)/search/+page.svelte @@ -6,15 +6,29 @@ import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte'; import ImageOffOutline from 'svelte-material-icons/ImageOffOutline.svelte'; import SearchBar from '$lib/components/shared-components/search-bar/search-bar.svelte'; + import { afterNavigate, goto } from '$app/navigation'; export let data: PageData; + + // The GalleryViewer pushes it's own history state, which causes weird + // behavior for history.back(). To prevent that we store the previous page + // manually and navigate back to that. + let previousRoute = '/explore'; + + afterNavigate(({ from }) => { + // Prevent setting previousRoute to the current page. + if (from && from.route.id !== $page.route.id) { + previousRoute = from.url.href; + } + }); + $: term = $page.url.searchParams.get('q') || data.term || '';
- history.back()} backIcon={ArrowLeft}> + goto(previousRoute)} backIcon={ArrowLeft}>
- +
@@ -24,7 +38,7 @@
{#if data.results?.assets?.items.length > 0}
- +
{:else}