From 811cd79206a0b5f8ce2bda340a663a7c7a766310 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 10 Apr 2017 17:39:27 +0100 Subject: [PATCH 1/2] Make the clear cache button work on desktop Fixes https://github.com/vector-im/riot-web/issues/3597 --- src/BasePlatform.js | 8 ++++++++ src/components/structures/UserSettings.js | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/BasePlatform.js b/src/BasePlatform.js index 8bdf7d0391..6eed22f436 100644 --- a/src/BasePlatform.js +++ b/src/BasePlatform.js @@ -82,4 +82,12 @@ export default class BasePlatform { screenCaptureErrorString() { return "Not implemented"; } + + /** + * Restarts the application, without neccessarily reloading + * any application code + */ + reload() { + throw new Error("reload not implemented!"); + } } diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index b2c2251455..53daa55fd8 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -441,10 +441,10 @@ module.exports = React.createClass({ }, _onClearCacheClicked: function() { + if (!PlatformPeg.get()) return; + MatrixClientPeg.get().store.deleteAllData().done(() => { - // forceReload=false since we don't really need new HTML/JS files - // we just need to restart the JS runtime. - window.location.reload(false); + PlatformPeg.get().reload(); }); }, From d4dc16545acccd6689af1b41a8fd4bafecb274c9 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 11 Apr 2017 18:16:29 +0100 Subject: [PATCH 2/2] Fix people section vanishing on 'clear cache' Stop the client first Fixes https://github.com/vector-im/riot-web/issues/3610 --- src/components/structures/UserSettings.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 53daa55fd8..892865fdf9 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -443,6 +443,7 @@ module.exports = React.createClass({ _onClearCacheClicked: function() { if (!PlatformPeg.get()) return; + MatrixClientPeg.get().stopClient(); MatrixClientPeg.get().store.deleteAllData().done(() => { PlatformPeg.get().reload(); });