Skip to content

High performance self-hosted photo and video management solution.

fix: preserve scroll position on memories page (#31588)

Yarosaa38c40c1c19
diff --git a/web/src/routes/(user)/memories/+page.svelte b/web/src/routes/(user)/memories/+page.svelte
index c2b4f3d93f..1ef87221dc 100644
--- a/web/src/routes/(user)/memories/+page.svelte
+++ b/web/src/routes/(user)/memories/+page.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import { scrollMemory } from '$lib/actions/scroll-memory';
import UserPageLayout from '$lib/components/layouts/UserPageLayout.svelte';
import { memoryManager } from '$lib/managers/memory-manager.svelte';
import { userPreferencesManager } from '$lib/managers/user-preferences-manager.svelte';
@@ -60,6 +61,7 @@
<UserPageLayout
title={data.meta.title}
description={memoryManager.total === undefined ? undefined : `(${memoryManager.total.toLocaleString($locale)})`}
+ use={[[scrollMemory, { routeStartsWith: Route.memories() }]]}
>
{#snippet buttons()}
<div class="flex place-items-center gap-2">
diff --git a/web/src/routes/(user)/memories/[id]/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte b/web/src/routes/(user)/memories/[id]/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte
index 99d8fd5bf0..d527890dfc 100644
--- a/web/src/routes/(user)/memories/[id]/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte
+++ b/web/src/routes/(user)/memories/[id]/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
+ import { scrollMemoryClearer } from '$lib/actions/scroll-memory';
import { shortcuts } from '$lib/actions/shortcut';
import ButtonContextMenu from '$lib/components/shared-components/context-menu/ButtonContextMenu.svelte';
import MenuOption from '$lib/components/shared-components/context-menu/MenuOption.svelte';
@@ -300,6 +301,7 @@
id="memory-viewer"
data-sveltekit-noscroll
class="dark w-full bg-immich-dark-gray text-white"
+ use:scrollMemoryClearer={{ routeStartsWith: Route.memories() }}
bind:this={memoryWrapper}
bind:clientHeight={viewport.height}
bind:clientWidth={viewport.width}