Remove flash after create workspace (#5589)
## Before https://github.com/twentyhq/twenty/assets/29927851/a6b4f580-4f01-4f5b-a023-f9fa0d9f9c28 ## After https://github.com/twentyhq/twenty/assets/29927851/2a1feb44-27ce-457d-86a2-eea46a313f98
This commit is contained in:
@ -2,10 +2,18 @@ import React from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { isCurrentUserLoadedState } from '@/auth/states/isCurrentUserLoadingState';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
||||
import { UserOrMetadataLoader } from '~/loading/components/UserOrMetadataLoader';
|
||||
|
||||
export const UserProvider = ({ children }: React.PropsWithChildren) => {
|
||||
const isCurrentUserLoaded = useRecoilValue(isCurrentUserLoadedState);
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
|
||||
return !isCurrentUserLoaded ? <UserOrMetadataLoader /> : <>{children}</>;
|
||||
return !isCurrentUserLoaded &&
|
||||
!isMatchingLocation(AppPath.CreateWorkspace) ? (
|
||||
<UserOrMetadataLoader />
|
||||
) : (
|
||||
<>{children}</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user