martmull
2024-05-27 12:14:50 +02:00
committed by GitHub
parent 1f9c340bc6
commit bcb5cf7ad7

View File

@ -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}</>
);
};