Fix actions being performed before the redux state is set up

pull/1430/head
Thibaut Girka 2020-09-28 17:09:59 +02:00
parent f8205b7b4a
commit 6dde075425
1 changed files with 16 additions and 15 deletions

View File

@ -364,21 +364,6 @@ class UI extends React.Component {
} }
componentWillMount () { componentWillMount () {
if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support
this.visibilityHiddenProp = 'hidden';
this.visibilityChange = 'visibilitychange';
} else if (typeof document.msHidden !== 'undefined') {
this.visibilityHiddenProp = 'msHidden';
this.visibilityChange = 'msvisibilitychange';
} else if (typeof document.webkitHidden !== 'undefined') {
this.visibilityHiddenProp = 'webkitHidden';
this.visibilityChange = 'webkitvisibilitychange';
}
if (this.visibilityChange !== undefined) {
document.addEventListener(this.visibilityChange, this.handleVisibilityChange, false);
this.handleVisibilityChange();
}
window.addEventListener('beforeunload', this.handleBeforeUnload, false); window.addEventListener('beforeunload', this.handleBeforeUnload, false);
document.addEventListener('dragenter', this.handleDragEnter, false); document.addEventListener('dragenter', this.handleDragEnter, false);
document.addEventListener('dragover', this.handleDragOver, false); document.addEventListener('dragover', this.handleDragOver, false);
@ -402,6 +387,22 @@ class UI extends React.Component {
this.hotkeys.__mousetrap__.stopCallback = (e, element) => { this.hotkeys.__mousetrap__.stopCallback = (e, element) => {
return ['TEXTAREA', 'SELECT', 'INPUT'].includes(element.tagName) && !e.altKey; return ['TEXTAREA', 'SELECT', 'INPUT'].includes(element.tagName) && !e.altKey;
}; };
if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support
this.visibilityHiddenProp = 'hidden';
this.visibilityChange = 'visibilitychange';
} else if (typeof document.msHidden !== 'undefined') {
this.visibilityHiddenProp = 'msHidden';
this.visibilityChange = 'msvisibilitychange';
} else if (typeof document.webkitHidden !== 'undefined') {
this.visibilityHiddenProp = 'webkitHidden';
this.visibilityChange = 'webkitvisibilitychange';
}
if (this.visibilityChange !== undefined) {
document.addEventListener(this.visibilityChange, this.handleVisibilityChange, false);
this.handleVisibilityChange();
}
} }
componentDidUpdate (prevProps) { componentDidUpdate (prevProps) {