open room sublist when using alt-arrows to navigate into it, refire scroll event
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
7d28137cfd
commit
d7ca374991
2 changed files with 26 additions and 11 deletions
|
@ -111,6 +111,8 @@ export default class RoomSubList extends React.PureComponent {
|
|||
}
|
||||
|
||||
onAction = (payload) => {
|
||||
switch (payload.action) {
|
||||
case 'on_room_read':
|
||||
// XXX: Previously RoomList would forceUpdate whenever on_room_read is dispatched,
|
||||
// but this is no longer true, so we must do it here (and can apply the small
|
||||
// optimisation of checking that we care about the room being read).
|
||||
|
@ -118,11 +120,23 @@ export default class RoomSubList extends React.PureComponent {
|
|||
// Ultimately we need to transition to a state pushing flow where something
|
||||
// explicitly notifies the components concerned that the notif count for a room
|
||||
// has change (e.g. a Flux store).
|
||||
if (payload.action === 'on_room_read' &&
|
||||
this.props.list.some((r) => r.roomId === payload.roomId)
|
||||
) {
|
||||
if (this.props.list.some((r) => r.roomId === payload.roomId)) {
|
||||
this.forceUpdate();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'view_room':
|
||||
if (this.state.hidden && !this.props.forceExpand &&
|
||||
this.props.list.some((r) => r.roomId === payload.room_id)
|
||||
) {
|
||||
this.onClick();
|
||||
// re-fire to scroll the room tile, normally it catches `view_room` but here it wasn't rendered yet.
|
||||
dis.dispatch({
|
||||
action: 'scroll_room_tile',
|
||||
room_id: payload.room_id,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onClick = (ev) => {
|
||||
|
|
|
@ -226,6 +226,7 @@ export default createReactClass({
|
|||
this.forceUpdate();
|
||||
break;
|
||||
|
||||
case 'scroll_room_tile':
|
||||
case 'view_room':
|
||||
// when the room is selected make sure its tile is visible, for breadcrumbs/keyboard shortcuts
|
||||
if (payload.room_id === this.props.room.roomId && this._roomTile.current) {
|
||||
|
|
Loading…
Reference in a new issue