Fix race condition while loading metadata on sign in (#9027)
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { isAppWaitingForFreshObjectMetadataState } from '@/object-metadata/states/isAppWaitingForFreshObjectMetadataState';
|
||||
import { UserOrMetadataLoader } from '~/loading/components/UserOrMetadataLoader';
|
||||
|
||||
export const ObjectMetadataItemsGater = ({
|
||||
children,
|
||||
}: React.PropsWithChildren) => {
|
||||
const isAppWaitingForFreshObjectMetadata = useRecoilValue(
|
||||
isAppWaitingForFreshObjectMetadataState,
|
||||
);
|
||||
|
||||
const shouldDisplayChildren = !isAppWaitingForFreshObjectMetadata;
|
||||
|
||||
return (
|
||||
<>{shouldDisplayChildren ? <>{children}</> : <UserOrMetadataLoader />}</>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user