diff --git a/src/browser/index.jsx b/src/browser/index.jsx index ca63ae8e..088afaae 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -286,7 +286,7 @@ var TabBar = React.createClass({ var MattermostView = React.createClass({ getInitialState: function() { return { - did_fail_load: null + errorInfo: null }; }, handleUnreadCountChange: function(unreadCount, mentionCount, isUnread, isMentioned) { @@ -317,8 +317,14 @@ var MattermostView = React.createClass({ icon: '../resources/appicon.png' }); thisObj.setState({ - did_fail_load: e + errorInfo: e }); + setTimeout(() => { + thisObj.setState({ + errorInfo: null + }); + webview.reload(); + }, 30000); }); // Open link in browserWindow. for exmaple, attached files. @@ -403,14 +409,16 @@ var MattermostView = React.createClass({ }); }, render: function() { + const errorView = this.state.errorInfo ? () : null; // 'disablewebsecurity' is necessary to display external images. // However, it allows also CSS/JavaScript. // So webview should use 'allowDisplayingInsecureContent' as same as BrowserWindow. - if (this.state.did_fail_load === null) { - return (); - } else { - return () - } + + // Need to keep webview mounted when failed to load. + return (
+ { errorView } + +
); } });