This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
Fix issue with room duplication caused by filtering and selecting room using keyboard #6389
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Wrap sticky room updates in lock to prevent
setStickyRoom
running in middle ofsetKnownRooms
Fixes the most common reproductions of element-hq/element-web#14508 but likely not all
So I reproduced this 100% of the time when filtering room list and selecting the room using keyboard.
The difference this has is it also clears the filter at the same time.
This makes two events race in the RoomListStore:
This issue came about from when the filtering was split into prefiltering and runtime filtering as prior to that the filters were applied later.
In theory a mutex around the critical path in setKnownRooms solves this.
I can no longer reproduce it using the steps which reproduced it 100% of the time for me.
This is much less invasive than #6024
But there is a significant likelihood that other reproduction methods for the same symptoms may still be possible given this is just one race and the RoomListStore is rather complex and has too much async logic.