Skip to content

Commit

Permalink
support for undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
plasne committed Feb 1, 2024
1 parent f0fad75 commit f5c319d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/mgt-chat/src/components/ChatList/ChatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -241,7 +241,7 @@ export const ChatList = ({
<FluentThemeProvider fluentTheme={FluentTheme}>
<FluentProvider theme={webLightTheme} className={styles.fullHeight}>
<div className={styles.fullHeight}>
{Providers.globalProvider.state === ProviderState.SignedIn && (
{Providers.globalProvider?.state === ProviderState.SignedIn && (
<div className={styles.headerContainer}>
<ChatListHeader
bannerMessage={headerBannerMessage}
Expand Down

0 comments on commit f5c319d

Please sign in to comment.