diff --git a/web/src/lib/components/shared-components/navigation-bar/navigation-bar.svelte b/web/src/lib/components/shared-components/navigation-bar/navigation-bar.svelte index 1bbf34316c8d52..59b85fc34c5946 100644 --- a/web/src/lib/components/shared-components/navigation-bar/navigation-bar.svelte +++ b/web/src/lib/components/shared-components/navigation-bar/navigation-bar.svelte @@ -6,9 +6,9 @@ import SkipLink from '$lib/components/elements/buttons/skip-link.svelte'; import Icon from '$lib/components/elements/icon.svelte'; import { featureFlags } from '$lib/stores/server-config.store'; - import { user } from '$lib/stores/user.store'; + import { aboutInfo, user } from '$lib/stores/user.store'; import { handleLogout } from '$lib/utils/auth'; - import { getAboutInfo, logout, type ServerAboutResponseDto } from '@immich/sdk'; + import { getAboutInfo, logout } from '@immich/sdk'; import { mdiHelpCircleOutline, mdiMagnify, mdiTrayArrowUp } from '@mdi/js'; import { t } from 'svelte-i18n'; import { fade } from 'svelte/transition'; @@ -38,17 +38,18 @@ await handleLogout(redirectUri); }; - let aboutInfo: ServerAboutResponseDto | undefined = $state(); - onMount(async () => { - aboutInfo = await getAboutInfo(); + if ($aboutInfo) { + return; + } + $aboutInfo = await getAboutInfo(); }); {#if shouldShowHelpPanel && aboutInfo} - (shouldShowHelpPanel = false)} info={aboutInfo} /> + (shouldShowHelpPanel = false)} info={$aboutInfo} /> {/if}
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 d90d7dec01c87c..55342b5b836912 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 @@ -1,23 +1,25 @@ -{#each albums as album} +{#each $recentAlbums as album} { + if ($aboutInfo && $versions && $serverVersion) { + return; + } await requestServerInfo(); - [info, versions] = await Promise.all([getAboutInfo(), getVersionHistory()]); + [$aboutInfo, $versions] = await Promise.all([getAboutInfo(), getVersionHistory()]); }); - let isMain = $derived(info?.sourceRef === 'main' && info.repository === 'immich-app/immich'); + let isMain = $derived($aboutInfo?.sourceRef === 'main' && $aboutInfo.repository === 'immich-app/immich'); let version = $derived( $serverVersion ? `v${$serverVersion.major}.${$serverVersion.minor}.${$serverVersion.patch}` : null, ); -{#if isOpen && info} - (isOpen = false)} {info} {versions} /> +{#if isOpen && $aboutInfo} + (isOpen = false)} info={$aboutInfo} versions={$versions} /> {/if}
(isOpen = true)} class="dark:text-immich-gray flex gap-1"> {#if isMain} - {info?.sourceRef} + {$aboutInfo?.sourceRef} {:else} {version} {/if} 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 c0de9378acafff..1c16f4e164cd45 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 @@ -38,6 +38,9 @@ }); onMount(async () => { + if ($serverInfo && $user) { + return; + } await requestServerInfo(); }); diff --git a/web/src/lib/stores/user.store.ts b/web/src/lib/stores/user.store.ts index 5bffc08b803a2f..2a5d3941ce4d8f 100644 --- a/web/src/lib/stores/user.store.ts +++ b/web/src/lib/stores/user.store.ts @@ -1,5 +1,11 @@ import { purchaseStore } from '$lib/stores/purchase.store'; -import { type UserAdminResponseDto, type UserPreferencesResponseDto } from '@immich/sdk'; +import { + type AlbumResponseDto, + type ServerAboutResponseDto, + type ServerVersionHistoryResponseDto, + type UserAdminResponseDto, + type UserPreferencesResponseDto, +} from '@immich/sdk'; import { writable } from 'svelte/store'; export const user = writable(); @@ -14,3 +20,9 @@ export const resetSavedUser = () => { preferences.set(undefined as unknown as UserPreferencesResponseDto); purchaseStore.setPurchaseStatus(false); }; + +export const recentAlbums = writable(); + +export const versions = writable(); + +export const aboutInfo = writable();