From a60209db3e74d14bfdf8f5ee8039ee5466409229 Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:16:56 +0100 Subject: [PATCH] fix(web): prevent infinite loop when modifying stacked asset (#14162) --- .../lib/components/asset-viewer/asset-viewer.svelte | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 988707cfa7..e5b1377965 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -32,7 +32,7 @@ type AssetResponseDto, type StackResponseDto, } from '@immich/sdk'; - import { onDestroy, onMount } from 'svelte'; + import { onDestroy, onMount, untrack } from 'svelte'; import { t } from 'svelte-i18n'; import { fly } from 'svelte/transition'; import Thumbnail from '../assets/thumbnail/thumbnail.svelte'; @@ -120,9 +120,11 @@ stack = null; } - if (stack && stack?.assets.length > 1) { - preloadAssets.push(stack.assets[1]); - } + untrack(() => { + if (stack && stack?.assets.length > 1) { + preloadAssets.push(stack.assets[1]); + } + }); }; const handleAddComment = () => {