Changes for performance improvement. The primary improvements include replacing GraphQL queries with REST-based client configuration fetching and making the client config non render-blocking
23 lines
662 B
TypeScript
23 lines
662 B
TypeScript
import { useRecoilValue } from 'recoil';
|
|
|
|
import { clientConfigApiStatusState } from '@/client-config/states/clientConfigApiStatusState';
|
|
import { AppFullScreenErrorFallback } from '@/error-handler/components/AppFullScreenErrorFallback';
|
|
|
|
export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
|
children,
|
|
}) => {
|
|
const { isErrored, error } = useRecoilValue(clientConfigApiStatusState);
|
|
|
|
return isErrored && error instanceof Error ? (
|
|
<AppFullScreenErrorFallback
|
|
error={error}
|
|
resetErrorBoundary={() => {
|
|
window.location.reload();
|
|
}}
|
|
title="Unable to Reach Back-end"
|
|
/>
|
|
) : (
|
|
children
|
|
);
|
|
};
|