Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Merged
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
20 changes: 19 additions & 1 deletion src/components/views/rooms/RoomList.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ module.exports = React.createClass({
incomingCallTag: null,
incomingCall: null,
selectedTags: [],
hover: false,
};
},

Expand Down Expand Up @@ -294,6 +295,17 @@ module.exports = React.createClass({
this.forceUpdate();
},

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

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

// Refresh the room list just in case the user missed something.
this._delayedRefreshRoomList();
},

_delayedRefreshRoomList: new rate_limited_func(function() {
this.refreshRoomList();
}, 500),
Expand Down Expand Up @@ -346,6 +358,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 @@ -693,7 +710,8 @@ module.exports = React.createClass({
const subListComponents = this._mapSubListProps(subLists);

return (
<div ref={this._collectResizeContainer} className="mx_RoomList">
<div ref={this._collectResizeContainer} className="mx_RoomList"
onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
{ subListComponents }
</div>
);
Expand Down