Files
explore/ui/shared/AppError/AppErrorBoundary.tsx
T
tom goriunovandGitHub 05945f6cf7 refactor page layout components (#1087)
* update csv export text

* fix pw tests

* base layout and customization for home page and search results page

* refactor rest of the pages

* refactor AppError

* move header padding to layout

* move nextjs utils to separate folder

* combine PageServer and Page

* make useQueryClientConfig hook

* add tests

* remove unused var

* fix envs for pw

* fix pw tests
2023-08-15 19:28:00 -04:00

28 lines
688 B
TypeScript

import { chakra } from '@chakra-ui/react';
import React from 'react';
import ErrorBoundary from 'ui/shared/ErrorBoundary';
import AppError from './AppError';
interface Props {
className?: string;
children: React.ReactNode;
onError?: (error: Error) => void;
}
const AppErrorBoundary = ({ className, children, onError }: Props) => {
const renderErrorScreen = React.useCallback((error?: Error) => {
return <AppError error={ error } className={ className }/>;
}, [ className ]);
return (
<ErrorBoundary renderErrorScreen={ renderErrorScreen } onError={ onError }>
{ children }
</ErrorBoundary>
);
};
export default React.memo(chakra(AppErrorBoundary));