PLT-3897 Fixed ALT+UP/DOWN crashing browser (#3848)
* Fixed ALT+UP/DOWN crashing browser * changed order of return
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
80d83ae77c
Коммит
05f8d138f4
@@ -65,6 +65,7 @@ export default class Sidebar extends React.Component {
|
|||||||
this.updateScrollbarOnChannelChange = this.updateScrollbarOnChannelChange.bind(this);
|
this.updateScrollbarOnChannelChange = this.updateScrollbarOnChannelChange.bind(this);
|
||||||
|
|
||||||
this.isLeaving = new Map();
|
this.isLeaving = new Map();
|
||||||
|
this.isSwitchingChannel = false;
|
||||||
|
|
||||||
const state = this.getStateFromStores();
|
const state = this.getStateFromStores();
|
||||||
state.newChannelModalType = '';
|
state.newChannelModalType = '';
|
||||||
@@ -281,6 +282,12 @@ export default class Sidebar extends React.Component {
|
|||||||
navigateChannelShortcut(e) {
|
navigateChannelShortcut(e) {
|
||||||
if (e.altKey && !e.shiftKey && (e.keyCode === Constants.KeyCodes.UP || e.keyCode === Constants.KeyCodes.DOWN)) {
|
if (e.altKey && !e.shiftKey && (e.keyCode === Constants.KeyCodes.UP || e.keyCode === Constants.KeyCodes.DOWN)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (this.isSwitchingChannel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isSwitchingChannel = true;
|
||||||
const allChannels = this.getDisplayedChannels();
|
const allChannels = this.getDisplayedChannels();
|
||||||
const curChannelId = this.state.activeId;
|
const curChannelId = this.state.activeId;
|
||||||
let curIndex = -1;
|
let curIndex = -1;
|
||||||
@@ -299,12 +306,19 @@ export default class Sidebar extends React.Component {
|
|||||||
nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)];
|
nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)];
|
||||||
ChannelActions.goToChannel(nextChannel);
|
ChannelActions.goToChannel(nextChannel);
|
||||||
this.updateScrollbarOnChannelChange(nextChannel);
|
this.updateScrollbarOnChannelChange(nextChannel);
|
||||||
|
this.isSwitchingChannel = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateUnreadChannelShortcut(e) {
|
navigateUnreadChannelShortcut(e) {
|
||||||
if (e.altKey && e.shiftKey && (e.keyCode === Constants.KeyCodes.UP || e.keyCode === Constants.KeyCodes.DOWN)) {
|
if (e.altKey && e.shiftKey && (e.keyCode === Constants.KeyCodes.UP || e.keyCode === Constants.KeyCodes.DOWN)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (this.isSwitchingChannel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isSwitchingChannel = true;
|
||||||
const allChannels = this.getDisplayedChannels();
|
const allChannels = this.getDisplayedChannels();
|
||||||
const curChannelId = this.state.activeId;
|
const curChannelId = this.state.activeId;
|
||||||
let curIndex = -1;
|
let curIndex = -1;
|
||||||
@@ -333,6 +347,7 @@ export default class Sidebar extends React.Component {
|
|||||||
nextChannel = allChannels[nextIndex];
|
nextChannel = allChannels[nextIndex];
|
||||||
ChannelActions.goToChannel(nextChannel);
|
ChannelActions.goToChannel(nextChannel);
|
||||||
this.updateScrollbarOnChannelChange(nextChannel);
|
this.updateScrollbarOnChannelChange(nextChannel);
|
||||||
|
this.isSwitchingChannel = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user