Feat/error boundaries (#2779)

* - Changed to objectNameSingular always defined
- Added ErrorCatchAll

* - Added mock mode for companies logged out
- Added a proper ErrorBoundary component

* Removed react-error-boundary

* Implemented proper ErrorBoundary

* Fixes

* Change strategy about mocks

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Lucas Bordeau
2023-12-01 22:06:38 +01:00
committed by GitHub
parent a301f451f9
commit 74b077f3ca
75 changed files with 4213 additions and 674 deletions

View File

@@ -0,0 +1,26 @@
import { FallbackProps } from 'react-error-boundary';
type GenericErrorFallbackProps = FallbackProps;
export const GenericErrorFallback = ({
error,
resetErrorBoundary,
}: GenericErrorFallbackProps) => {
return (
<div
style={{
color: 'red',
display: 'flex',
flexDirection: 'column',
gap: '20px',
alignItems: 'center',
justifyContent: 'center',
width: '100%',
height: '100%',
}}
>
<div>{error.message}</div>
<button onClick={() => resetErrorBoundary()}>Retry</button>
</div>
);
};