mirror of https://github.com/vector-im/riot-web
open room sublist when using alt-arrows to navigate into it, refire scroll event
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
7d28137cfd
commit
d7ca374991
|
@ -111,17 +111,31 @@ export default class RoomSubList extends React.PureComponent {
|
|||
}
|
||||
|
||||
onAction = (payload) => {
|
||||
// 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).
|
||||
//
|
||||
// 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)
|
||||
) {
|
||||
this.forceUpdate();
|
||||
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).
|
||||
//
|
||||
// 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 (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,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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 New Issue