Merge pull request #574 from yuya-oc/fix-unexpected-reloading
Fix an extra reloading when an error page is manually reloaded
This commit is contained in:
commit
e9e82c6278
|
@ -31,6 +31,8 @@ Release date: TBD
|
||||||
[#552](https://github.com/mattermost/desktop/issues/552)
|
[#552](https://github.com/mattermost/desktop/issues/552)
|
||||||
- Fixed the app publisher was not changed to Mattermost, Inc.
|
- Fixed the app publisher was not changed to Mattermost, Inc.
|
||||||
[#542](https://github.com/mattermost/desktop/issues/542)
|
[#542](https://github.com/mattermost/desktop/issues/542)
|
||||||
|
- Fixed an extra reloading when an error page is manually reloaded.
|
||||||
|
[#573](https://github.com/mattermost/desktop/issues/573)
|
||||||
|
|
||||||
#### Windows
|
#### Windows
|
||||||
- Fixed desktop notifications not working when the window has been minimized from inactive state.
|
- Fixed desktop notifications not working when the window has been minimized from inactive state.
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
// eslint-disable react/no-set-state
|
||||||
|
// setState() is necessary for this component
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const PropTypes = require('prop-types');
|
const PropTypes = require('prop-types');
|
||||||
const createReactClass = require('create-react-class');
|
const createReactClass = require('create-react-class');
|
||||||
|
@ -26,7 +29,8 @@ const MattermostView = createReactClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
errorInfo: null,
|
errorInfo: null,
|
||||||
isContextMenuAdded: false
|
isContextMenuAdded: false,
|
||||||
|
reloadTimeoutID: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -54,7 +58,9 @@ const MattermostView = createReactClass({
|
||||||
self.reload();
|
self.reload();
|
||||||
}
|
}
|
||||||
if (navigator.onLine) {
|
if (navigator.onLine) {
|
||||||
setTimeout(reload, 30000);
|
self.setState({
|
||||||
|
reloadTimeoutID: setTimeout(reload, 30000)
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
window.addEventListener('online', reload);
|
window.addEventListener('online', reload);
|
||||||
}
|
}
|
||||||
|
@ -152,8 +158,10 @@ const MattermostView = createReactClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
|
clearTimeout(this.state.reloadTimeoutID);
|
||||||
this.setState({
|
this.setState({
|
||||||
errorInfo: null
|
errorInfo: null,
|
||||||
|
reloadTimeoutID: null
|
||||||
});
|
});
|
||||||
var webview = findDOMNode(this.refs.webview);
|
var webview = findDOMNode(this.refs.webview);
|
||||||
webview.reload();
|
webview.reload();
|
||||||
|
|
Loading…
Reference in a new issue