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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 63 additions and 20 deletions

View file

@ -7,6 +7,7 @@
import Icon from '$lib/components/elements/icon.svelte';
import { featureFlags } from '$lib/stores/server-config.store';
import { user } from '$lib/stores/user.store';
import { userInteraction } from '$lib/stores/user.svelte';
import { handleLogout } from '$lib/utils/auth';
import { getAboutInfo, logout, type ServerAboutResponseDto } from '@immich/sdk';
import { mdiHelpCircleOutline, mdiMagnify, mdiTrayArrowUp } from '@mdi/js';
@ -38,17 +39,17 @@
await handleLogout(redirectUri);
};
let aboutInfo: ServerAboutResponseDto | undefined = $state();
let info: ServerAboutResponseDto | undefined = $state();
onMount(async () => {
aboutInfo = await getAboutInfo();
info = userInteraction.aboutInfo ?? (await getAboutInfo());
});
</script>
<svelte:window bind:innerWidth />
{#if shouldShowHelpPanel && aboutInfo}
<HelpAndFeedbackModal onClose={() => (shouldShowHelpPanel = false)} info={aboutInfo} />
{#if shouldShowHelpPanel && info}
<HelpAndFeedbackModal onClose={() => (shouldShowHelpPanel = false)} {info} />
{/if}
<section id="dashboard-navbar" class="fixed z-[900] h-[var(--navbar-height)] w-screen text-sm">