From f5c319d78b75ccb2b7a5b94567ca323149d6b1de Mon Sep 17 00:00:00 2001 From: Peter Lasne Date: Thu, 1 Feb 2024 16:27:29 -0500 Subject: [PATCH] support for undefined --- packages/mgt-chat/src/components/ChatList/ChatList.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mgt-chat/src/components/ChatList/ChatList.tsx b/packages/mgt-chat/src/components/ChatList/ChatList.tsx index e5adb0688b..2c453e18b9 100644 --- a/packages/mgt-chat/src/components/ChatList/ChatList.tsx +++ b/packages/mgt-chat/src/components/ChatList/ChatList.tsx @@ -94,7 +94,7 @@ export const ChatList = ({ // wait for provider to be ready before setting client and state useEffect(() => { const provider = Providers.globalProvider; - const conditionalLoad = (state: ProviderState) => { + const conditionalLoad = (state: ProviderState | undefined) => { if (state === ProviderState.SignedIn && !chatListClient) { const client = new StatefulGraphChatListClient(chatThreadsPerPage); setChatListClient(client); @@ -104,7 +104,7 @@ export const ChatList = ({ provider.onStateChanged(evt => { conditionalLoad(evt.detail); }); - conditionalLoad(provider.state); + conditionalLoad(provider?.state); }, [chatListClient, chatThreadsPerPage]); // if selected chat id is changed, update the internal state @@ -241,7 +241,7 @@ export const ChatList = ({
- {Providers.globalProvider.state === ProviderState.SignedIn && ( + {Providers.globalProvider?.state === ProviderState.SignedIn && (