microsoft-graph-toolkit icon indicating copy to clipboard operation
microsoft-graph-toolkit copied to clipboard

[BUG] [MGT-CHAT] Rapid switching between chats can cause messages from the wrong chat to be cached

Open plasne opened this issue 4 months ago • 0 comments

Describe the bug By switching quickly between chats, it is possible for messages from the wrong chat to be cached and shown.

To Reproduce To reproduce this issue you need to be able to switch quickly between chats. You can use the ChatList component in PR if you want.

Steps to reproduce the behavior:

  1. Clear all cache in mgt-conversations / chats
  2. Open a chat but before it finishes loading
  3. Switch to a different chat and before it finishes loading
  4. Switch to a different chat
  5. Observe that the chat contains messages from several of those that were not finished loading. Moreover they are not just displayed, but also in the cache for the wrong chat.

NOTE: this is not 100% reproduceable. I am pretty sure this happens because a graph call is started but not completed under chatID X and then its response is received when the component is chatID Y.

Expected behavior When set to a specific chatID you never see messages from another chatID.

Screenshots Here is the chat in MGT: image

Here is the chat in Teams: image

Messages 111 and 112 actually came from this chat: image

Notice that in the cache, the key doesn't match the chat ID: image

Environment (please complete the following information):

  • OS: macOS Monteray 12.7.3
  • Browser: edge
  • Framework: react
  • Context: Web
  • Version: we tested version 4, but this probably appeared previously
  • Provider: Msal2Provider

Additional context I am a MSFT employee, you can reach me on Teams at pelasne.

plasne avatar Feb 09 '24 21:02 plasne