Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Add error boundary to Auth modal. For #2811

Gabe Kangas41bf0154bf3f
diff --git a/web/components/modals/AuthModal/AuthModal.tsx b/web/components/modals/AuthModal/AuthModal.tsx
index ac681dcd7e..26ec667205 100644
--- a/web/components/modals/AuthModal/AuthModal.tsx
+++ b/web/components/modals/AuthModal/AuthModal.tsx
@@ -1,6 +1,7 @@
import { Tabs } from 'antd';
import { useRecoilValue } from 'recoil';
import { FC } from 'react';
+import { ErrorBoundary } from 'react-error-boundary';
import { IndieAuthModal } from '../IndieAuthModal/IndieAuthModal';
import { FediAuthModal } from '../FediAuthModal/FediAuthModal';
@@ -12,6 +13,7 @@ import {
clientConfigStateAtom,
} from '../../stores/ClientConfigStore';
import { ClientConfig } from '../../../interfaces/client-config.model';
+import { ComponentError } from '../../ui/ComponentError/ComponentError';
export type AuthModalProps = {
forceTabs?: boolean;
@@ -66,14 +68,25 @@ export const AuthModal: FC<AuthModalProps> = ({ forceTabs }) => {
];
return (
- <div>
- <Tabs
- defaultActiveKey="1"
- items={items}
- type="card"
- size="small"
- renderTabBar={fediverseEnabled || forceTabs ? null : () => null}
- />
- </div>
+ <ErrorBoundary
+ // eslint-disable-next-line react/no-unstable-nested-components
+ fallbackRender={({ error, resetErrorBoundary }) => (
+ <ComponentError
+ componentName="ChatContainer"
+ message={error.message}
+ retryFunction={resetErrorBoundary}
+ />
+ )}
+ >
+ <div>
+ <Tabs
+ defaultActiveKey="1"
+ items={items}
+ type="card"
+ size="small"
+ renderTabBar={fediverseEnabled || forceTabs ? null : () => null}
+ />
+ </div>
+ </ErrorBoundary>
);
};