fix: reduce the number of API requests when changing route (#14666)

* fix: reduce the number of API requests when changing route

* fix: reset `userInteraction` after sign out
This commit is contained in:
martin
2024-12-16 15:45:01 +01:00
committed by GitHub
parent 6b0f9ec46c
commit 8945a5d862
9 changed files with 63 additions and 20 deletions

View File

@@ -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(