Skip to content

Commit

Permalink
Remove flash after create workspace (twentyhq#5589)
Browse files Browse the repository at this point in the history
  • Loading branch information
martmull authored May 27, 2024
1 parent 1f9c340 commit bcb5cf7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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}</>
);
};

0 comments on commit bcb5cf7

Please sign in to comment.