{
+ state: ErrorBoundaryState = { error: null };
+
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
+ this.setState({ error });
+ console.error(error, errorInfo);
+ }
+
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState {
+ return { error };
+ }
+
+ render(): ReactNode {
+ const { error } = this.state;
+
+ if (!error) {
+ return this.props.children;
+ }
+
+ return (
+
+
Something went wrong.
+ {error.toString()}
+
+ );
+ }
+}
+
+export const withErrorBoundary = (
+ Component: ComponentType,
+): ((props: Props) => JSX.Element) => {
+ return (props: Props) => (
+
+
+
+ );
+};
diff --git a/src/pages/maps/GoogleMapsPage/GoogleMapsPage.tsx b/src/pages/maps/GoogleMapsPage/GoogleMapsPage.tsx
index 59ab008b9..ed75d3c3e 100644
--- a/src/pages/maps/GoogleMapsPage/GoogleMapsPage.tsx
+++ b/src/pages/maps/GoogleMapsPage/GoogleMapsPage.tsx
@@ -6,11 +6,13 @@ import { useTranslation } from 'react-i18next';
import { PageTitle } from '@app/components/common/PageTitle/PageTitle';
import * as S from '@app/pages/maps/maps.styles';
+import { ErrorBoundary } from '@app/hocs/ErrorBoundary';
+
const GoogleMaps: React.FC = () => {
const { t } = useTranslation();
return (
- <>
+
{t('common.googleMap')}
{
defaultZoom={6}
/>
- >
+
);
};
diff --git a/src/pages/uiComponentsPages/forms/RatesPage.tsx b/src/pages/uiComponentsPages/forms/RatesPage.tsx
index cf963eeac..6e5202ae3 100644
--- a/src/pages/uiComponentsPages/forms/RatesPage.tsx
+++ b/src/pages/uiComponentsPages/forms/RatesPage.tsx
@@ -31,8 +31,8 @@ const RatesPage: React.FC = () => {
- index + 1} />
- customIcons[index + 1]} />
+ (index as number) + 1} />
+ customIcons[(index as number) + 1]} />