Skip to content

Commit

Permalink
fix: reset userInteraction after sign out
Browse files Browse the repository at this point in the history
  • Loading branch information
martabal committed Dec 15, 2024
1 parent 53e2b8b commit 41f3fc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions web/src/lib/stores/user.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ interface UserInteractions {
serverInfo?: ServerStorageResponseDto;
}

export const userInteraction = $state<UserInteractions>({
const defaultUserInteraction: UserInteractions = {
recentAlbums: undefined,
versions: undefined,
aboutInfo: undefined,
serverInfo: undefined,
});
};

export const resetUserInteractoin = () => {
Object.assign(userInteraction, defaultUserInteraction);
};

export const userInteraction = $state<UserInteractions>(defaultUserInteraction);
3 changes: 2 additions & 1 deletion web/src/lib/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { goto } from '$app/navigation';
import { foldersStore } from '$lib/stores/folders.svelte';
import { purchaseStore } from '$lib/stores/purchase.store';
import { preferences as preferences$, resetSavedUser, user as user$ } from '$lib/stores/user.store';
import { userInteraction } from '$lib/stores/user.svelte';
import { resetUserInteractoin, userInteraction } from '$lib/stores/user.svelte';
import { getAboutInfo, getMyPreferences, getMyUser, getStorage } from '@immich/sdk';
import { redirect } from '@sveltejs/kit';
import { DateTime } from 'luxon';
Expand Down Expand Up @@ -99,6 +99,7 @@ export const handleLogout = async (redirectUri: string) => {
}
} finally {
resetSavedUser();
resetUserInteractoin();
foldersStore.clearCache();
}
};

0 comments on commit 41f3fc0

Please sign in to comment.