From 8dbc8a07cf58ea18bbcf1a2c02c2a9f059f25f99 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sat, 6 May 2023 14:11:09 -0700 Subject: [PATCH] feat(embeds): wrap chat embeds in error components --- web/pages/embed/chat/readonly/index.tsx | 35 +++++++++++------- web/pages/embed/chat/readwrite/index.tsx | 46 +++++++++++++++--------- 2 files changed, 52 insertions(+), 29 deletions(-) diff --git a/web/pages/embed/chat/readonly/index.tsx b/web/pages/embed/chat/readonly/index.tsx index 8a2ea39ee..282b9a851 100644 --- a/web/pages/embed/chat/readonly/index.tsx +++ b/web/pages/embed/chat/readonly/index.tsx @@ -1,4 +1,5 @@ import { useRecoilValue } from 'recoil'; +import { ErrorBoundary } from 'react-error-boundary'; import { ChatMessage } from '../../../../interfaces/chat-message.model'; import { ChatContainer } from '../../../../components/chat/ChatContainer/ChatContainer'; import { @@ -8,6 +9,7 @@ import { isChatAvailableSelector, } from '../../../../components/stores/ClientConfigStore'; import { Theme } from '../../../../components/theme/Theme'; +import { ComponentError } from '../../../../components/ui/ComponentError/ComponentError'; export default function ReadOnlyChatEmbed() { const currentUser = useRecoilValue(currentUserAtom); @@ -16,19 +18,26 @@ export default function ReadOnlyChatEmbed() { return (
- - - {currentUser && ( - - )} + ( + + )} + > + + + {currentUser && ( + + )} +
); } diff --git a/web/pages/embed/chat/readwrite/index.tsx b/web/pages/embed/chat/readwrite/index.tsx index 365e1edb6..6b7fbfc59 100644 --- a/web/pages/embed/chat/readwrite/index.tsx +++ b/web/pages/embed/chat/readwrite/index.tsx @@ -1,6 +1,7 @@ /* eslint-disable react/no-unknown-property */ import { useRecoilValue } from 'recoil'; import { useEffect } from 'react'; +import { ErrorBoundary } from 'react-error-boundary'; import { ChatMessage } from '../../../../interfaces/chat-message.model'; import { ChatContainer } from '../../../../components/chat/ChatContainer/ChatContainer'; import { @@ -17,6 +18,7 @@ import { ClientConfig } from '../../../../interfaces/client-config.model'; import { AppStateOptions } from '../../../../components/stores/application-state'; import { ServerStatus } from '../../../../interfaces/server-status.model'; import { Theme } from '../../../../components/theme/Theme'; +import { ComponentError } from '../../../../components/ui/ComponentError/ComponentError'; export default function ReadWriteChatEmbed() { const currentUser = useRecoilValue(currentUserAtom); @@ -47,22 +49,34 @@ export default function ReadWriteChatEmbed() { } `} - - -
- {currentUser && ( -
- -
- )} + ( + + )} + > + + +
+ {currentUser && ( +
+ +
+ )} + ); }