From 0a31efa0b7cb845a1940b7a4ae36a674fa89417a Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 17 Feb 2017 15:16:28 +0000 Subject: [PATCH] Add a 'Clear Cache' button This deletes the IndexedDB database and reloads the page. This solely exists as a get-out clause for users in case the indexedDB instance gets corrupted. Hopefully we won't ever need to point users to it. --- src/components/structures/UserSettings.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index f8240e247b..b928243d40 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -418,6 +418,14 @@ module.exports = React.createClass({ Modal.createDialog(BugReportDialog, {}); }, + _onClearCacheClicked: function() { + MatrixClientPeg.get().store.deleteAllData().then(() => { + // forceReload=false since we don't really need new HTML/JS files + // we just need to restart the JS runtime. + window.location.reload(false); + }); + }, + _onInviteStateChange: function(event, member, oldMembership) { if (member.userId === this._me && oldMembership === "invite") { this.forceUpdate(); @@ -690,6 +698,18 @@ module.exports = React.createClass({ ; }, + _renderClearCache: function() { + return
+

Clear Cache

+
+ + Clear Cache (triggers page refresh) + +
+
; + }, + _renderBulkOptions: function() { let invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => { return r.hasMembershipState(this._me, "invite"); @@ -913,6 +933,8 @@ module.exports = React.createClass({ + {this._renderClearCache()} + {this._renderDeactivateAccount()}