Fix sign-up bug because currentCacheVersion does not exist yet
This commit is contained in:
@ -3,12 +3,14 @@ import { Controller, SubmitHandler, useForm } from 'react-hook-form';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
|
import { useSetRecoilState } from 'recoil';
|
||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { SubTitle } from '@/auth/components/SubTitle';
|
import { SubTitle } from '@/auth/components/SubTitle';
|
||||||
import { Title } from '@/auth/components/Title';
|
import { Title } from '@/auth/components/Title';
|
||||||
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
|
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
|
||||||
|
import { isCurrentUserLoadedState } from '@/auth/states/isCurrentUserLoadingState';
|
||||||
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
|
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
|
||||||
import { FIND_MANY_OBJECT_METADATA_ITEMS } from '@/object-metadata/graphql/queries';
|
import { FIND_MANY_OBJECT_METADATA_ITEMS } from '@/object-metadata/graphql/queries';
|
||||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||||
@ -19,7 +21,6 @@ import { Loader } from '@/ui/feedback/loader/components/Loader.tsx';
|
|||||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||||
import { MainButton } from '@/ui/input/button/components/MainButton';
|
import { MainButton } from '@/ui/input/button/components/MainButton';
|
||||||
import { TextInput } from '@/ui/input/components/TextInput';
|
import { TextInput } from '@/ui/input/components/TextInput';
|
||||||
import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';
|
|
||||||
import { useActivateWorkspaceMutation } from '~/generated/graphql';
|
import { useActivateWorkspaceMutation } from '~/generated/graphql';
|
||||||
import { isDefined } from '~/utils/isDefined';
|
import { isDefined } from '~/utils/isDefined';
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ export const CreateWorkspace = () => {
|
|||||||
|
|
||||||
const [activateWorkspace] = useActivateWorkspaceMutation();
|
const [activateWorkspace] = useActivateWorkspaceMutation();
|
||||||
const apolloMetadataClient = useApolloMetadataClient();
|
const apolloMetadataClient = useApolloMetadataClient();
|
||||||
|
const setIsCurrentUserLoaded = useSetRecoilState(isCurrentUserLoadedState);
|
||||||
|
|
||||||
// Form
|
// Form
|
||||||
const {
|
const {
|
||||||
@ -75,8 +77,8 @@ export const CreateWorkspace = () => {
|
|||||||
displayName: data.name,
|
displayName: data.name,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
refetchQueries: [GET_CURRENT_USER],
|
|
||||||
});
|
});
|
||||||
|
setIsCurrentUserLoaded(false);
|
||||||
|
|
||||||
await apolloMetadataClient?.refetchQueries({
|
await apolloMetadataClient?.refetchQueries({
|
||||||
include: [FIND_MANY_OBJECT_METADATA_ITEMS],
|
include: [FIND_MANY_OBJECT_METADATA_ITEMS],
|
||||||
@ -95,7 +97,13 @@ export const CreateWorkspace = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[enqueueSnackBar, navigate, apolloMetadataClient, activateWorkspace],
|
[
|
||||||
|
activateWorkspace,
|
||||||
|
setIsCurrentUserLoaded,
|
||||||
|
apolloMetadataClient,
|
||||||
|
navigate,
|
||||||
|
enqueueSnackBar,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
|||||||
@ -107,7 +107,7 @@ export class WorkspaceResolver {
|
|||||||
return 'inactive';
|
return 'inactive';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResolveField(() => String)
|
@ResolveField(() => String, { nullable: true })
|
||||||
async currentCacheVersion(
|
async currentCacheVersion(
|
||||||
@Parent() workspace: Workspace,
|
@Parent() workspace: Workspace,
|
||||||
): Promise<string | null> {
|
): Promise<string | null> {
|
||||||
|
|||||||
Reference in New Issue
Block a user