Copy state when initialisng, reset state when logging out
This commit is contained in:
parent
f38690f265
commit
e1ea8f0a78
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue