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,17 +111,31 @@ export default class RoomSubList extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAction = (payload) => {
|
onAction = (payload) => {
|
||||||
// XXX: Previously RoomList would forceUpdate whenever on_room_read is dispatched,
|
switch (payload.action) {
|
||||||
// but this is no longer true, so we must do it here (and can apply the small
|
case 'on_room_read':
|
||||||
// optimisation of checking that we care about the room being 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
|
||||||
// Ultimately we need to transition to a state pushing flow where something
|
// optimisation of checking that we care about the room being read).
|
||||||
// explicitly notifies the components concerned that the notif count for a room
|
//
|
||||||
// has change (e.g. a Flux store).
|
// Ultimately we need to transition to a state pushing flow where something
|
||||||
if (payload.action === 'on_room_read' &&
|
// explicitly notifies the components concerned that the notif count for a room
|
||||||
this.props.list.some((r) => r.roomId === payload.roomId)
|
// has change (e.g. a Flux store).
|
||||||
) {
|
if (this.props.list.some((r) => r.roomId === payload.roomId)) {
|
||||||
this.forceUpdate();
|
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();
|
this.forceUpdate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'scroll_room_tile':
|
||||||
case 'view_room':
|
case 'view_room':
|
||||||
// when the room is selected make sure its tile is visible, for breadcrumbs/keyboard shortcuts
|
// 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) {
|
if (payload.room_id === this.props.room.roomId && this._roomTile.current) {
|
||||||
|
|
Loading…
Reference in a new issue