From e1ea8f0a780efda638046f6ef5c662c02972ed03 Mon Sep 17 00:00:00 2001 From: lukebarnard Date: Wed, 13 Dec 2017 10:57:47 +0000 Subject: [PATCH] Copy state when initialisng, reset state when logging out --- src/stores/TagOrderStore.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/stores/TagOrderStore.js b/src/stores/TagOrderStore.js index 820634b90e..633ffc7e9c 100644 --- a/src/stores/TagOrderStore.js +++ b/src/stores/TagOrderStore.js @@ -31,7 +31,7 @@ class TagOrderStore extends Store { super(dis); // Initialise state - this._state = INITIAL_STATE; + this._state = Object.assign({}, INITIAL_STATE); } _setState(newState) { @@ -93,6 +93,12 @@ class TagOrderStore extends Store { this._setState({orderedTags}); break; } + case 'on_logged_out': { + // Reset state without pushing an update to the view, which generally assumes that + // the matrix client isn't `null` and so causing a re-render will cause NPEs. + this._state = Object.assign({}, INITIAL_STATE); + break; + } } }