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

Don't re-sort the room list if the user is hovering over it #2393

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/components/views/rooms/RoomList.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ module.exports = React.createClass({
incomingCallTag: null,
incomingCall: null,
selectedTags: [],
hover: false,
};
},

Expand Down Expand Up @@ -255,6 +256,14 @@ module.exports = React.createClass({
}
},

onMouseEnter: function(ev) {
this.setState({hover: true});
},

onMouseLeave: function(ev) {
this.setState({hover: false});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we trigger a list refresh at this point to account for any room list changes that may have occurred while hovering but were ignored and so have not yet been displayed? Perhaps add this._delayedRefreshRoomList(); after this line.

},

_onGroupMyMembership: function(group) {
this.forceUpdate();
},
Expand Down Expand Up @@ -311,6 +320,11 @@ module.exports = React.createClass({
},

refreshRoomList: function() {
if (this.state.hover) {
// Don't re-sort the list if we're hovering over the list
return;
}

// TODO: ideally we'd calculate this once at start, and then maintain
// any changes to it incrementally, updating the appropriate sublists
// as needed.
Expand Down Expand Up @@ -654,7 +668,7 @@ module.exports = React.createClass({
return (
<GeminiScrollbarWrapper className="mx_RoomList_scrollbar"
autoshow={true} onScroll={self._whenScrolling} onResize={self._whenScrolling} wrappedRef={this._collectGemini}>
<div className="mx_RoomList">
<div className="mx_RoomList" onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
<RoomSubList list={[]}
extraTiles={this._makeGroupInviteTiles(self.props.searchFilter)}
label={_t('Community Invites')}
Expand Down