Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback for ChatList #79

Merged
merged 13 commits into from
Feb 28, 2024

Conversation

TechnicallyWilliams
Copy link
Collaborator

@TechnicallyWilliams TechnicallyWilliams commented Feb 27, 2024

This PR addresses some comments from Gavin on ChatList:

Completed:

  • todo: ChatList no longer references sign-in state to execute any logic.
  • todo: ChatListState state var is now only handler subscribed to statefulgraphchatlistclient state changes. UseEffect now relies on updates to ChatListState.
  • todo: implement offStateChange
  • todo: add doc to indicate why we are not adding deps
  • "todo": remove sign-in state check from chatlistItem

@seekdavidlee seekdavidlee marked this pull request as ready for review February 27, 2024 20:45
@plasne
Copy link
Owner

plasne commented Feb 27, 2024

We probably don't need the renewal locking currentUserId anymore since it cannot change now.

@seekdavidlee
Copy link
Collaborator

We probably don't need the renewal locking currentUserId anymore since it cannot change now.

what about when user is switched?

@plasne
Copy link
Owner

plasne commented Feb 27, 2024

We probably don't need the renewal locking currentUserId anymore since it cannot change now.

what about when user is switched?

That's a good question, but when that happens is there not a "sign-out" and "sign-in" event? And is the ChatList component recreated when that happens?

@seekdavidlee
Copy link
Collaborator

We probably don't need the renewal locking currentUserId anymore since it cannot change now.

what about when user is switched?

That's a good question, but when that happens is there not a "sign-out" and "sign-in" event? And is the ChatList component recreated when that happens?

we are still hooked into AccountChange event, so it is possible ChatList is still active I suppose, under StatefulGraphChatListClient.

Providers.globalProvider.onActiveAccountChanged(this.onActiveAccountChanged);

@plasne
Copy link
Owner

plasne commented Feb 27, 2024

We probably don't need the renewal locking currentUserId anymore since it cannot change now.

what about when user is switched?

That's a good question, but when that happens is there not a "sign-out" and "sign-in" event? And is the ChatList component recreated when that happens?

we are still hooked into AccountChange event, so it is possible ChatList is still active I suppose, under StatefulGraphChatListClient.

Providers.globalProvider.onActiveAccountChanged(this.onActiveAccountChanged);

I think we should test it. It would certainly be cleaner if it did do a sign-out and then back in.

@seekdavidlee
Copy link
Collaborator

We probably don't need the renewal locking currentUserId anymore since it cannot change now.

what about when user is switched?

That's a good question, but when that happens is there not a "sign-out" and "sign-in" event? And is the ChatList component recreated when that happens?

we are still hooked into AccountChange event, so it is possible ChatList is still active I suppose, under StatefulGraphChatListClient.
Providers.globalProvider.onActiveAccountChanged(this.onActiveAccountChanged);

I think we should test it. It would certainly be cleaner if it did do a sign-out and then back in.

I tested. Here, I switch between the 2 signed in users but we stay on the same page.

image

Co-authored-by: Dexter Williams <dexterwilliams04@gmail.com>
Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
mgt-chat.src.statefulClient 100% 100% 0
mgt-chat.src.utils 100% 89% 0
mgt-components.dist.es6.components.mgt-agenda.src.components.mgt-agenda 14% 100% 0
mgt-components.dist.es6.components.mgt-contact.src.components.mgt-contact 62% 100% 0
mgt-components.dist.es6.components.mgt-file-list.mgt-file-upload.src.components.mgt-file-list.mgt-file-upload 43% 100% 0
mgt-components.dist.es6.components.mgt-file-list.src.components.mgt-file-list 62% 100% 0
mgt-components.dist.es6.components.mgt-file.src.components.mgt-file 61% 100% 0
mgt-components.dist.es6.components.mgt-get.src.components.mgt-get 19% 100% 0
mgt-components.dist.es6.components.mgt-login.src.components.mgt-login 64% 100% 0
mgt-components.dist.es6.components.mgt-messages.src.components.mgt-messages 66% 100% 0
mgt-components.dist.es6.components.mgt-organization.src.components.mgt-organization 46% 100% 0
mgt-components.dist.es6.components.mgt-people-picker.src.components.mgt-people-picker 56% 100% 0
mgt-components.dist.es6.components.mgt-people.src.components.mgt-people 72% 100% 0
mgt-components.dist.es6.components.mgt-person-card.src.components.mgt-person-card 59% 33% 0
mgt-components.dist.es6.components.mgt-person.src.components.mgt-person 53% 100% 0
mgt-components.dist.es6.components.mgt-picker.src.components.mgt-picker 78% 100% 0
mgt-components.dist.es6.components.mgt-planner.src.components.mgt-planner 55% 100% 0
mgt-components.dist.es6.components.mgt-profile.src.components.mgt-profile 39% 100% 0
mgt-components.dist.es6.components.mgt-search-box.src.components.mgt-search-box 83% 100% 0
mgt-components.dist.es6.components.mgt-search-results.src.components.mgt-search-results 56% 100% 0
mgt-components.dist.es6.components.mgt-tasks-base.src.components.mgt-tasks-base 86% 100% 0
mgt-components.dist.es6.components.mgt-taxonomy-picker.src.components.mgt-taxonomy-picker 74% 100% 0
mgt-components.dist.es6.components.mgt-teams-channel-picker.src.components.mgt-teams-channel-picker 62% 100% 0
mgt-components.dist.es6.components.mgt-theme-toggle.src.components.mgt-theme-toggle 74% 100% 0
mgt-components.dist.es6.components.mgt-todo.src.components.mgt-todo 78% 100% 0
mgt-components.dist.es6.components.src.components 86% 100% 0
mgt-components.dist.es6.components.sub-components.mgt-arrow-options.src.components.sub-components.mgt-arrow-options 76% 100% 0
mgt-components.dist.es6.components.sub-components.mgt-dot-options.src.components.sub-components.mgt-dot-options 29% 100% 0
mgt-components.dist.es6.components.sub-components.mgt-flyout.src.components.sub-components.mgt-flyout 40% 100% 0
mgt-components.dist.es6.components.sub-components.mgt-spinner.src.components.sub-components.mgt-spinner 92% 100% 0
mgt-components.dist.es6.graph.src.graph 36% 100% 0
mgt-components.dist.es6.src 100% 100% 0
mgt-components.dist.es6.styles.src.styles 73% 100% 0
mgt-components.dist.es6.utils.src.utils 46% 100% 0
mgt-components.src.components 84% 75% 0
mgt-components.src.components.mgt-contact 68% 83% 0
mgt-components.src.components.mgt-file 62% 100% 0
mgt-components.src.components.mgt-file-list 46% 100% 0
mgt-components.src.components.mgt-file-list.mgt-file-upload 49% 86% 0
mgt-components.src.components.mgt-get 22% 100% 0
mgt-components.src.components.mgt-messages 68% 100% 0
mgt-components.src.components.mgt-organization 47% 100% 0
mgt-components.src.components.mgt-person 84% 76% 0
mgt-components.src.components.mgt-person-card 67% 48% 0
mgt-components.src.components.mgt-picker 80% 100% 0
mgt-components.src.components.mgt-profile 40% 100% 0
mgt-components.src.components.mgt-tasks-base 87% 100% 0
mgt-components.src.components.mgt-theme-toggle 100% 100% 0
mgt-components.src.components.mgt-todo 79% 100% 0
mgt-components.src.components.sub-components.mgt-flyout 72% 53% 0
mgt-components.src.components.sub-components.mgt-spinner 100% 100% 0
mgt-components.src.graph 40% 73% 0
mgt-components.src.styles 92% 80% 0
mgt-components.src.utils 82% 46% 0
mgt-element.dist.es6.components.src.components 72% 74% 0
mgt-element.dist.es6.mock.src.mock 91% 77% 0
mgt-element.dist.es6.providers.src.providers 87% 83% 0
mgt-element.dist.es6.src 91% 80% 0
mgt-element.dist.es6.utils.src.utils 67% 73% 0
mgt-element.src 93% 40% 0
mgt-element.src.components 78% 100% 0
mgt-element.src.mock 81% 56% 0
mgt-element.src.providers 83% 91% 0
mgt-element.src.utils 71% 90% 0
Summary 60% (28031 / 46554) 71% (562 / 795) 0

@@ -143,7 +144,7 @@ const ChatPage: React.FunctionComponent = () => {
</Dialog>
</div>
<div className={styles.side}>
<ChatListWrapper selectedChatId={chatId} onSelected={onChatSelected} onNewChat={onNewChat} />
{isSignedIn && <ChatListWrapper selectedChatId={chatId} onSelected={onChatSelected} onNewChat={onNewChat} />}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this the intended implementation? The user would somehow need to know to conditionally render this based on isSignedIn. If it was a prop, we can do this conditional render or just short circuit within the component. Plus the user knows they must provide it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a common approach, LGTM

@seekdavidlee seekdavidlee merged commit ec95d3c into next/mgt-chat Feb 28, 2024
8 checks passed
@seekdavidlee seekdavidlee deleted the dexterw/chatlist-rework-state-strategy branch February 28, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants