From b93632ddcb7005520e1b5cf66318e6c23a10d4bf Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Fri, 1 May 2026 15:35:56 +0200 Subject: [PATCH] fix(web): prevent timeline DOM retention during scroll --- .../lib/components/timeline/AssetLayout.svelte | 16 +++++----------- web/src/lib/components/timeline/Month.svelte | 13 ++++--------- web/src/lib/components/timeline/Timeline.svelte | 1 - 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/web/src/lib/components/timeline/AssetLayout.svelte b/web/src/lib/components/timeline/AssetLayout.svelte index 4ecf71f517..4048fd0ce0 100644 --- a/web/src/lib/components/timeline/AssetLayout.svelte +++ b/web/src/lib/components/timeline/AssetLayout.svelte @@ -2,20 +2,16 @@ import type { TimelineAsset } from '$lib/managers/timeline-manager/types'; import { filterIsInOrNearViewport } from '$lib/managers/timeline-manager/utils.svelte'; import type { ViewerAsset } from '$lib/managers/timeline-manager/viewer-asset.svelte'; - import type { VirtualScrollManager } from '$lib/managers/VirtualScrollManager/VirtualScrollManager.svelte'; - import { uploadAssetsStore } from '$lib/stores/upload'; import type { CommonPosition } from '$lib/utils/layout-utils'; import type { Snippet } from 'svelte'; import { flip } from 'svelte/animate'; import { scale } from 'svelte/transition'; - let { isUploading } = uploadAssetsStore; - type Props = { viewerAssets: ViewerAsset[]; width: number; height: number; - manager: VirtualScrollManager; + suspendTransitions: boolean; thumbnail: Snippet< [ { @@ -27,10 +23,7 @@ customThumbnailLayout?: Snippet<[asset: TimelineAsset]>; }; - const { viewerAssets, width, height, manager, thumbnail, customThumbnailLayout }: Props = $props(); - - const transitionDuration = $derived(manager.suspendTransitions && !$isUploading ? 0 : 150); - const scaleDuration = $derived(transitionDuration === 0 ? 0 : transitionDuration + 100); + const { viewerAssets, width, height, suspendTransitions, thumbnail, customThumbnailLayout }: Props = $props(); @@ -40,6 +33,7 @@ {@const asset = viewerAsset.asset!} +
{@render thumbnail({ asset, position })} {@render customThumbnailLayout?.(asset)} diff --git a/web/src/lib/components/timeline/Month.svelte b/web/src/lib/components/timeline/Month.svelte index 28996b204a..8e2b7759d4 100644 --- a/web/src/lib/components/timeline/Month.svelte +++ b/web/src/lib/components/timeline/Month.svelte @@ -5,7 +5,6 @@ import type { TimelineMonth } from '$lib/managers/timeline-manager/timeline-month.svelte'; import type { TimelineAsset } from '$lib/managers/timeline-manager/types'; import { assetsSnapshot, filterIsInOrNearViewport } from '$lib/managers/timeline-manager/utils.svelte'; - import type { VirtualScrollManager } from '$lib/managers/VirtualScrollManager/VirtualScrollManager.svelte'; import { uploadAssetsStore } from '$lib/stores/upload'; import type { CommonPosition } from '$lib/utils/layout-utils'; import { fromTimelinePlainDate, getDateLocaleString } from '$lib/utils/timeline-util'; @@ -28,7 +27,6 @@ singleSelect: boolean; assetInteraction: AssetMultiSelectManager; timelineMonth: TimelineMonth; - manager: VirtualScrollManager; onTimelineDaySelect: (timelineDay: TimelineDay, assets: TimelineAsset[]) => void; }; let { @@ -37,14 +35,13 @@ singleSelect, assetInteraction, timelineMonth, - manager, onTimelineDaySelect, }: Props = $props(); let { isUploading } = uploadAssetsStore; let hoveredTimelineDay = $state(null); - const transitionDuration = $derived(timelineMonth.timelineManager.suspendTransitions && !$isUploading ? 0 : 150); + const suspendTransitions = $derived(timelineMonth.timelineManager.suspendTransitions && !$isUploading); const getTimelineDayFullDate = (timelineDay: TimelineDay): string => { const { month, year } = timelineDay.timelineMonth.yearMonth; @@ -61,10 +58,8 @@ {@const isTimelineDaySelected = assetInteraction.selectedGroup.has(timelineDay.groupTitle)}
{#snippet thumbnail({ asset, position })} diff --git a/web/src/lib/components/timeline/Timeline.svelte b/web/src/lib/components/timeline/Timeline.svelte index bcef9f3260..7cd05610dd 100644 --- a/web/src/lib/components/timeline/Timeline.svelte +++ b/web/src/lib/components/timeline/Timeline.svelte @@ -670,7 +670,6 @@ {customThumbnailLayout} {singleSelect} {timelineMonth} - manager={timelineManager} onTimelineDaySelect={handleGroupSelect} > {#snippet thumbnail({ asset, position, timelineDay, groupIndex })}