From 61bf5344bfac076397a27503ee8153da5c9565fe Mon Sep 17 00:00:00 2001 From: Jonas Schwabe Date: Fri, 22 Jul 2016 07:36:45 +0200 Subject: [PATCH 1/3] Workaround for bad cache handling in mattermost platform, fixes #212 --- src/browser/index.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/browser/index.jsx b/src/browser/index.jsx index 364713ee..dac3434a 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -312,7 +312,8 @@ var MattermostView = React.createClass({ webview.addEventListener('did-fail-load', function(e) { console.log(thisObj.props.name, 'webview did-fail-load', e); - if (e.errorCode === -3) { // An operation was aborted (due to user action). + if (e.errorCode === -3 || // An operation was aborted (due to user action). + webview.cacheInvalidated) { //The operation was aborted to invalidate application cache return; } @@ -349,6 +350,13 @@ var MattermostView = React.createClass({ } }); + webview.addEventListener("did-start-loading", function() { + if (!webview.cacheInvalidated) { + webview.reloadIgnoringCache(); + webview.cacheInvalidated = true; + } + }); + webview.addEventListener("dom-ready", function() { // webview.openDevTools(); From 93263aea3a4160b7b0954f5e17e74dce5ba4b42d Mon Sep 17 00:00:00 2001 From: Jonas Schwabe Date: Fri, 22 Jul 2016 08:32:51 +0200 Subject: [PATCH 2/3] Fix error handler which showed an error on reload, as the cancel event was triggered after the cacheInvalidated property has been set to true --- src/browser/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/index.jsx b/src/browser/index.jsx index dac3434a..07f701dc 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -313,7 +313,7 @@ var MattermostView = React.createClass({ webview.addEventListener('did-fail-load', function(e) { console.log(thisObj.props.name, 'webview did-fail-load', e); if (e.errorCode === -3 || // An operation was aborted (due to user action). - webview.cacheInvalidated) { //The operation was aborted to invalidate application cache + e.errorCode === -300) { //The operation was aborted to invalidate application cache return; } From 58dfda760ea933d4708041c0dfe4b50de7b1ea21 Mon Sep 17 00:00:00 2001 From: Jonas Schwabe Date: Tue, 9 Aug 2016 15:27:10 +0200 Subject: [PATCH 3/3] add chaneglog for forceReload PR --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2d00347..32c34576 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Release date: TBD - Changed display of unread messages on the team tabbar, they are now shown as bold text - Reload only the selected tab and keep its URL on "Reload" and "Clear Cache and Reload". - Disabled `eval()` function for security improvements. +- Invalidate cache before load, to make server upgrades easy #### Windows - Update Mattermost icon for desktop notifications in Windows 10.