From 02ca54d8107ec31fe6336e538202093990f092a0 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 12 Mar 2023 23:07:02 -0700 Subject: [PATCH] Add error boundary to UserDropdown. For #2811 --- .../common/UserDropdown/UserDropdown.tsx | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/web/components/common/UserDropdown/UserDropdown.tsx b/web/components/common/UserDropdown/UserDropdown.tsx index 94aeaf09d..1ce0a25dd 100644 --- a/web/components/common/UserDropdown/UserDropdown.tsx +++ b/web/components/common/UserDropdown/UserDropdown.tsx @@ -4,6 +4,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'; import { FC, useState } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; import dynamic from 'next/dynamic'; +import { ErrorBoundary } from 'react-error-boundary'; import { chatVisibleToggleAtom, currentUserAtom, @@ -11,6 +12,7 @@ import { } from '../../stores/ClientConfigStore'; import styles from './UserDropdown.module.scss'; import { AppStateOptions } from '../../stores/application-state'; +import { ComponentError } from '../../ui/ComponentError/ComponentError'; // Lazy loaded components @@ -109,23 +111,38 @@ export const UserDropdown: FC = ({ username: defaultUsername ); return ( -
- - - - setShowNameChangeModal(false)} - > - - - setShowAuthModal(false)}> - - -
+ ( + + )} + > +
+ + + + setShowNameChangeModal(false)} + > + + + setShowAuthModal(false)} + > + + +
+
); };