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;
|
}, 60000) as unknown as number;
|
||||||
|
|
||||||
const { load: loadIdentities } = useLazyCurrentUserIdentities();
|
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
console.debug("Before mount App");
|
console.debug("Before mount App");
|
||||||
if (initializeCurrentUser()) {
|
if (initializeCurrentUser()) {
|
||||||
try {
|
try {
|
||||||
const result = await loadIdentities();
|
const result = useLazyCurrentUserIdentities();
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
await initializeCurrentActor(result.loggedUser.actors);
|
await initializeCurrentActor(result.result.value?.loggedUser.actors);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof NoIdentitiesException) {
|
if (err instanceof NoIdentitiesException) {
|
||||||
await router.push({
|
await router.push({
|
||||||
|
|
|
@ -23,7 +23,7 @@ export function useCurrentActorClient() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useLazyCurrentUserIdentities() {
|
export function useLazyCurrentUserIdentities() {
|
||||||
return useLazyQuery<{
|
return useQuery<{
|
||||||
loggedUser: Pick<ICurrentUser, "actors">;
|
loggedUser: Pick<ICurrentUser, "actors">;
|
||||||
}>(IDENTITIES);
|
}>(IDENTITIES);
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,17 +238,15 @@ const loginAction = (e: Event) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const { load: loadIdentities } = useLazyCurrentUserIdentities();
|
|
||||||
|
|
||||||
const { onDone: onCurrentUserMutationDone, mutate: updateCurrentUserMutation } =
|
const { onDone: onCurrentUserMutationDone, mutate: updateCurrentUserMutation } =
|
||||||
useMutation(UPDATE_CURRENT_USER_CLIENT);
|
useMutation(UPDATE_CURRENT_USER_CLIENT);
|
||||||
|
|
||||||
onCurrentUserMutationDone(async () => {
|
onCurrentUserMutationDone(async () => {
|
||||||
console.debug("Current user mutation done, now setuping actors…");
|
console.debug("Current user mutation done, now setuping actors…");
|
||||||
try {
|
try {
|
||||||
const result = await loadIdentities();
|
const result = useLazyCurrentUserIdentities();
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
await initializeCurrentActor(result.loggedUser.actors);
|
await initializeCurrentActor(result.result.value?.loggedUser.actors);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
if (err instanceof NoIdentitiesException && currentUser.value) {
|
if (err instanceof NoIdentitiesException && currentUser.value) {
|
||||||
await router.push({
|
await router.push({
|
||||||
|
|
Loading…
Reference in a new issue