ReadonlyHidden.tsx

 1import React from 'react';
 2
 3import CurrentIdentityContext from './CurrentIdentityContext';
 4
 5type Props = { children: React.ReactNode };
 6const ReadonlyHidden = ({ children }: Props) => (
 7  <CurrentIdentityContext.Consumer>
 8    {context => {
 9      if (!context) return null;
10      const { loading, error, data } = context;
11
12      if (error || loading || !data?.repository?.userIdentity) return null;
13
14      return <>{children}</>;
15    }}
16  </CurrentIdentityContext.Consumer>
17);
18
19export default ReadonlyHidden;