diff --git a/web/src/lib/components/shared-components/side-bar/recent-albums.svelte b/web/src/lib/components/shared-components/side-bar/recent-albums.svelte
index d90d7dec01..b11935d643 100644
--- a/web/src/lib/components/shared-components/side-bar/recent-albums.svelte
+++ b/web/src/lib/components/shared-components/side-bar/recent-albums.svelte
@@ -4,13 +4,19 @@
import { getAllAlbums, type AlbumResponseDto } from '@immich/sdk';
import { handleError } from '$lib/utils/handle-error';
import { t } from 'svelte-i18n';
+ import { userInteraction } from '$lib/stores/user.svelte';
let albums: AlbumResponseDto[] = $state([]);
onMount(async () => {
+ if (userInteraction.recentAlbums) {
+ albums = userInteraction.recentAlbums;
+ return;
+ }
try {
const allAlbums = await getAllAlbums({});
albums = allAlbums.sort((a, b) => (a.updatedAt > b.updatedAt ? -1 : 1)).slice(0, 3);
+ userInteraction.recentAlbums = albums;
} catch (error) {
handleError(error, $t('failed_to_load_assets'));
}
diff --git a/web/src/lib/components/shared-components/side-bar/server-status.svelte b/web/src/lib/components/shared-components/side-bar/server-status.svelte
index 2a0e6a0821..e1d7340c46 100644
--- a/web/src/lib/components/shared-components/side-bar/server-status.svelte
+++ b/web/src/lib/components/shared-components/side-bar/server-status.svelte
@@ -12,17 +12,24 @@
} from '@immich/sdk';
import Icon from '$lib/components/elements/icon.svelte';
import { mdiAlert } from '@mdi/js';
+ import { userInteraction } from '$lib/stores/user.svelte';
const { serverVersion, connected } = websocketStore;
let isOpen = $state(false);
-
let info: ServerAboutResponseDto | undefined = $state();
let versions: ServerVersionHistoryResponseDto[] = $state([]);
onMount(async () => {
+ if (userInteraction.aboutInfo && userInteraction.versions && $serverVersion) {
+ info = userInteraction.aboutInfo;
+ versions = userInteraction.versions;
+ return;
+ }
await requestServerInfo();
[info, versions] = await Promise.all([getAboutInfo(), getVersionHistory()]);
+ userInteraction.aboutInfo = info;
+ userInteraction.versions = versions;
});
let isMain = $derived(info?.sourceRef === 'main' && info.repository === 'immich-app/immich');
let version = $derived(
diff --git a/web/src/lib/components/shared-components/side-bar/storage-space.svelte b/web/src/lib/components/shared-components/side-bar/storage-space.svelte
index c0de9378ac..9472397565 100644
--- a/web/src/lib/components/shared-components/side-bar/storage-space.svelte
+++ b/web/src/lib/components/shared-components/side-bar/storage-space.svelte
@@ -1,18 +1,18 @@
@@ -54,7 +57,7 @@
{$t('storage')}
- {#if $serverInfo}
+ {#if userInteraction.serverInfo}
{$t('storage_usage', {
values: {
diff --git a/web/src/lib/stores/server-info.store.ts b/web/src/lib/stores/server-info.store.ts
deleted file mode 100644
index 360b2c5630..0000000000
--- a/web/src/lib/stores/server-info.store.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import type { ServerStorageResponseDto } from '@immich/sdk';
-import { writable } from 'svelte/store';
-
-export const serverInfo = writable();
diff --git a/web/src/lib/stores/user.svelte.ts b/web/src/lib/stores/user.svelte.ts
new file mode 100644
index 0000000000..71b2cdd847
--- /dev/null
+++ b/web/src/lib/stores/user.svelte.ts
@@ -0,0 +1,26 @@
+import type {
+ AlbumResponseDto,
+ ServerAboutResponseDto,
+ ServerStorageResponseDto,
+ ServerVersionHistoryResponseDto,
+} from '@immich/sdk';
+
+interface UserInteractions {
+ recentAlbums?: AlbumResponseDto[];
+ versions?: ServerVersionHistoryResponseDto[];
+ aboutInfo?: ServerAboutResponseDto;
+ serverInfo?: ServerStorageResponseDto;
+}
+
+const defaultUserInteraction: UserInteractions = {
+ recentAlbums: undefined,
+ versions: undefined,
+ aboutInfo: undefined,
+ serverInfo: undefined,
+};
+
+export const resetUserInteraction = () => {
+ Object.assign(userInteraction, defaultUserInteraction);
+};
+
+export const userInteraction = $state(defaultUserInteraction);
diff --git a/web/src/lib/utils/auth.ts b/web/src/lib/utils/auth.ts
index fe0a4b42d4..b706d3012e 100644
--- a/web/src/lib/utils/auth.ts
+++ b/web/src/lib/utils/auth.ts
@@ -2,8 +2,8 @@ import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { foldersStore } from '$lib/stores/folders.svelte';
import { purchaseStore } from '$lib/stores/purchase.store';
-import { serverInfo } from '$lib/stores/server-info.store';
import { preferences as preferences$, resetSavedUser, user as user$ } from '$lib/stores/user.store';
+import { resetUserInteraction, userInteraction } from '$lib/stores/user.svelte';
import { getAboutInfo, getMyPreferences, getMyUser, getStorage } from '@immich/sdk';
import { redirect } from '@sveltejs/kit';
import { DateTime } from 'luxon';
@@ -72,7 +72,7 @@ export const authenticate = async (options?: AuthOptions) => {
export const requestServerInfo = async () => {
if (get(user$)) {
const data = await getStorage();
- serverInfo.set(data);
+ userInteraction.serverInfo = data;
}
};
@@ -99,6 +99,7 @@ export const handleLogout = async (redirectUri: string) => {
}
} finally {
resetSavedUser();
+ resetUserInteraction();
foldersStore.clearCache();
}
};