From 2c50f2e24475856b670c025d8ea6748dde857410 Mon Sep 17 00:00:00 2001 From: Snowknight26 Date: Thu, 6 Nov 2025 08:24:47 -0600 Subject: [PATCH] fix(web): add URLs to results in large files utility (#23617) fix(web): add URLs to results in large files --- .../[[assetId=id]]/+page.svelte | 38 ++++++++++++------- .../[[photos=photos]]/[[assetId=id]]/+page.ts | 6 ++- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.svelte index 40c70c9df2..06f075feb6 100644 --- a/web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -8,6 +8,7 @@ import { navigate } from '$lib/utils/navigation'; import { t } from 'svelte-i18n'; import type { PageData } from './$types'; + import type { AssetResponseDto } from '@immich/sdk'; interface Props { data: PageData; @@ -16,35 +17,42 @@ let { data }: Props = $props(); let assets = $derived(data.assets); + let asset = $derived(data.asset); const { isViewing: showAssetViewer, asset: viewingAsset, setAsset } = assetViewingStore; const getAssetIndex = (id: string) => assets.findIndex((asset) => asset.id === id); - const onNext = () => { + $effect(() => { + if (asset) { + setAsset(asset); + } + }); + + const onNext = async () => { const index = getAssetIndex($viewingAsset.id) + 1; if (index >= assets.length) { - return Promise.resolve(false); + return false; } - setAsset(assets[index]); - return Promise.resolve(true); + await onViewAsset(assets[index]); + return true; }; - const onPrevious = () => { + const onPrevious = async () => { const index = getAssetIndex($viewingAsset.id) - 1; if (index < 0) { - return Promise.resolve(false); + return false; } - setAsset(assets[index]); - return Promise.resolve(true); + await onViewAsset(assets[index]); + return true; }; - const onRandom = () => { + const onRandom = async () => { if (assets.length <= 0) { - return Promise.resolve(undefined); + return undefined; } const index = Math.floor(Math.random() * assets.length); const asset = assets[index]; - setAsset(asset); - return Promise.resolve(asset); + await onViewAsset(asset); + return asset; }; const onAction = (payload: Action) => { @@ -53,13 +61,17 @@ $showAssetViewer = false; } }; + + const onViewAsset = async (asset: AssetResponseDto) => { + await navigate({ targetRoute: 'current', assetId: asset.id }); + };
{#if assets && data.assets.length > 0} {#each assets as asset (asset.id)} - setAsset(asset)} /> + {/each} {:else}

diff --git a/web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.ts index 6780fdb023..19754bcff2 100644 --- a/web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.ts +++ b/web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.ts @@ -1,15 +1,17 @@ import { authenticate } from '$lib/utils/auth'; import { getFormatter } from '$lib/utils/i18n'; +import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { searchLargeAssets } from '@immich/sdk'; import type { PageLoad } from './$types'; -export const load = (async ({ url }) => { +export const load = (async ({ params, url }) => { await authenticate(url); - const assets = await searchLargeAssets({ minFileSize: 0 }); + const [assets, asset] = await Promise.all([searchLargeAssets({ minFileSize: 0 }), getAssetInfoFromParam(params)]); const $t = await getFormatter(); return { assets, + asset, meta: { title: $t('large_files'), },