From d8d699e0accc5479c4c663f023672b235aa575e8 Mon Sep 17 00:00:00 2001 From: Massedil Date: Sat, 28 Jun 2025 18:38:00 +0200 Subject: [PATCH] fix(login): identities should be null after a user disconnection Related to #1806 --- src/composition/apollo/actor.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/composition/apollo/actor.ts b/src/composition/apollo/actor.ts index 0d480513d..c2c401a73 100644 --- a/src/composition/apollo/actor.ts +++ b/src/composition/apollo/actor.ts @@ -37,16 +37,23 @@ export function useLazyCurrentUserIdentities() { export function useCurrentUserIdentities() { const { currentUser } = useCurrentUserClient(); + const enabled = computed( + () => + currentUser.value?.id !== undefined && + currentUser.value?.id !== null && + currentUser.value?.isLoggedIn === true + ); + const { result, error, loading } = useQuery<{ loggedUser: Pick; }>(IDENTITIES, {}, () => ({ - enabled: - currentUser.value?.id !== undefined && - currentUser.value?.id !== null && - currentUser.value?.isLoggedIn === true, + enabled: enabled, })); - const identities = computed(() => result.value?.loggedUser?.actors); + const identities = computed(() => + enabled.value ? result.value?.loggedUser?.actors : null + ); + return { identities, error, loading }; }