Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Ensure the room list always triggers updates on itself #4175

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Mar 4, 2020

#4164 round two, without tripping all the bear traps that make this code awful to work with. Code is essentially stolen from @t3chguy to make the list stable, and actually update.

The index management stuff from #4164 appears to not be needed and is in fact one of the bear traps in this area.

Rewriting the whole room list store for element-hq/element-web#11743 is still a good idea, but in terms of actually fixing the bug this seems fine enough for now. It also means we can release without putting a block on rewriting the room list.

Fixes element-hq/element-web#12588

Edit: I've also broken out the commits to try and explain in future diffs what the problem was and what it fixes, hopefully.

All the update triggers for the RoomListStore go through the `setRoomCategory` function, so by returning early we're not actually calculating where a room should be in the list.
Not all algorithms are timestamp based.
@turt2live turt2live requested a review from a team March 4, 2020 19:14
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

if it works then sure, I had an this exact code at one point (except with a switch-case) and I had an issue where switching between two consecutive rooms it sometimes swapped them wrongly because the alphabetic comparison was done between the wrong entries because of the removal happening before the insertion

@turt2live
Copy link
Member Author

I had an issue where switching between two consecutive rooms it sometimes swapped them wrongly because the alphabetic comparison was done between the wrong entries because of the removal happening before the insertion

This is exactly the description of element-hq/element-web#9216 :D (just with a different algorithm). In the grand scheme of things it's obviously bad, but also less important. Something like element-hq/element-web#11743 would certainly fix it.

@turt2live turt2live merged commit 7f66198 into develop Mar 4, 2020
@turt2live turt2live deleted the travis/room-list-updates branch March 4, 2020 19:24
@t3chguy
Copy link
Member

t3chguy commented Mar 4, 2020

Ah right true, I guess I was aiming to fix that one in one fell swoop

@turt2live
Copy link
Member Author

yea, I highly don't recommend that. That bug is screaming for a refactor, which I'll still take a look at doing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Room list does not reorder on new messages
2 participants