Copy state when initialisng, reset state when logging out

This commit is contained in:
lukebarnard 2017-12-13 10:57:47 +00:00
parent f38690f265
commit e1ea8f0a78

View file

@ -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;
}
}
}