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

[BUG] [MGT-CHAT] Messages can be duplicated in the chat pane

Open plasne opened this issue 1 year ago • 2 comments

Describe the bug It is possible for the Chat component to render messages multiple times.

To Reproduce NOTE: You must have a fast way to switch chat threads. You can use the ChatList currently under development to repro if desired.

Steps to reproduce the behavior:

  1. Clear a single thread from IndexedDB cache
  2. Switch Chat to that thread
  3. Quickly switch to another thread (before #2 is done loading)
  4. Quickly switch to another thread (before #3 is done loading)
  5. Quickly switch to another thread (before #4 is done loading)
  6. Switch back to the original thread

You may see multiples of the same message. This is not always reproduceable, but it is common.

Expected behavior If there are 5 messages in the thread, there should be 5 messages rendered, not many duplicates of the same messages.

Screenshots "elephant" is the last message, but it is repeated about a dozen times:

image

There are only 5 messages in the cache (and only 5 messages in graph or Teams)...

image

You can see the 5 messages in Teams...

image

Showing that the cache is correct...

image

In addition, this throws an error in the console log because there are multiple messages with the same key...

image image image

Environment (please complete the following information):

  • OS: macOS Monterray 12.7.3
  • Browser: edge
  • Framework: react
  • Context: Web
  • Version: Tested with new v4, not sure if this was a problem before
  • Provider: Msal2Provider

Additional context I am a MSFT employee so you can hit me up on Teams at pelasne if desired.

plasne avatar Feb 09 '24 21:02 plasne