use useQuery instead of useLazyQuery in useLazyCurrentUserIdentities
In the hopes of fixing #44 through hints found at https://github.com/apollographql/apollo-client/issues/9354
This commit is contained in:
parent
864e2fa660
commit
a5b8530387
|
@ -139,15 +139,13 @@ interval.value = window.setInterval(async () => {
|
|||
}
|
||||
}, 60000) as unknown as number;
|
||||
|
||||
const { load: loadIdentities } = useLazyCurrentUserIdentities();
|
||||
|
||||
onBeforeMount(async () => {
|
||||
console.debug("Before mount App");
|
||||
if (initializeCurrentUser()) {
|
||||
try {
|
||||
const result = await loadIdentities();
|
||||
const result = useLazyCurrentUserIdentities();
|
||||
if (!result) return;
|
||||
await initializeCurrentActor(result.loggedUser.actors);
|
||||
await initializeCurrentActor(result.result.value?.loggedUser.actors);
|
||||
} catch (err) {
|
||||
if (err instanceof NoIdentitiesException) {
|
||||
await router.push({
|
||||
|
|
|
@ -23,7 +23,7 @@ export function useCurrentActorClient() {
|
|||
}
|
||||
|
||||
export function useLazyCurrentUserIdentities() {
|
||||
return useLazyQuery<{
|
||||
return useQuery<{
|
||||
loggedUser: Pick<ICurrentUser, "actors">;
|
||||
}>(IDENTITIES);
|
||||
}
|
||||
|
|
|
@ -238,17 +238,15 @@ const loginAction = (e: Event) => {
|
|||
});
|
||||
};
|
||||
|
||||
const { load: loadIdentities } = useLazyCurrentUserIdentities();
|
||||
|
||||
const { onDone: onCurrentUserMutationDone, mutate: updateCurrentUserMutation } =
|
||||
useMutation(UPDATE_CURRENT_USER_CLIENT);
|
||||
|
||||
onCurrentUserMutationDone(async () => {
|
||||
console.debug("Current user mutation done, now setuping actors…");
|
||||
try {
|
||||
const result = await loadIdentities();
|
||||
const result = useLazyCurrentUserIdentities();
|
||||
if (!result) return;
|
||||
await initializeCurrentActor(result.loggedUser.actors);
|
||||
await initializeCurrentActor(result.result.value?.loggedUser.actors);
|
||||
} catch (err: any) {
|
||||
if (err instanceof NoIdentitiesException && currentUser.value) {
|
||||
await router.push({
|
||||
|
|
Loading…
Reference in a new issue