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

Always insert rooms into lists when they get lost #2736

Merged
merged 2 commits into from
Mar 2, 2019

Conversation

turt2live
Copy link
Member

Room upgrades, direct chats, etc all end up being lost in these scenarios. Instead of losing them to the list, try and put them into a relevant spot of the list.

Fixes element-hq/element-web#9020

Demo:

  1. Switch between some rooms to prove they aren't lost
  2. Upgrade the demo room to show it doesn't get lost
  3. Switch between a bunch of rooms in different ways to prove they aren't lost

Repeating the steps without this patch results in rooms disappearing from the room list.

upgrades mp4

Room upgrades, direct chats, etc all end up being lost in these scenarios. Instead of losing them to the list, try and put them into a relevant spot of the list.

Fixes element-hq/element-web#9020
@turt2live turt2live requested a review from a team March 1, 2019 22:50
}
} else {
insertedIntoTags.push(key);
// There's some circumstances where the room doesn't fit anywhere, so just
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be good to detail here what the circumstance are, if we know them now.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's almost always "ran off the list" - I've adjusted the approach to instead try and fix this more calmly.

insertedIntoTags.push(key);
} else {
// In theory, this should never happen
console.warn(`!! Room ${room.roomId} lost: No position available`);
Copy link
Collaborator

@jryans jryans Mar 1, 2019

Choose a reason for hiding this comment

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

Is it worth keeping some kind of logging that it would have been lost without this new fallback? (Do we hope to do something better in the future?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely - have added a bunch of logging

Instead of having a catch-all insert, try and fix the common cases with a bit more care.
@turt2live turt2live requested a review from jryans March 2, 2019 00:19
Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

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

Thanks, hopefully we'll be able to keep improving this with the extra info.

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.

2 participants