microsoft-graph-toolkit
microsoft-graph-toolkit copied to clipboard
[BUG] [MGT-CHAT] Messages can be duplicated in the chat pane
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:
- Clear a single thread from IndexedDB cache
- Switch Chat to that thread
- Quickly switch to another thread (before #2 is done loading)
- Quickly switch to another thread (before #3 is done loading)
- Quickly switch to another thread (before #4 is done loading)
- 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:
There are only 5 messages in the cache (and only 5 messages in graph or Teams)...
You can see the 5 messages in Teams...
Showing that the cache is correct...
In addition, this throws an error in the console log because there are multiple messages with the same key...
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.