Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Reset store state when logging out #930

Merged

Conversation

lukebarnard1
Copy link
Contributor

@lukebarnard1 lukebarnard1 commented May 25, 2017

This prevents leaking of state that we do not want to share with the next user

Luke Barnard added 3 commits May 25, 2017 17:04
This prevents RoomView from doing any peeking whilst the join/registration is in progress, causing weirdness with TimelinePanel getPendingEventList (which throws an error if called when peeking).
These must now make a dispatch to RoomViewStore instead of calling `viewRoom` directly on MatrixChat. This will call both `viewRoom` of MatrixChat _and_ the logic in RVS so there is some redundancy here. It'd be best to move as much as possible of viewRoom out to the RVS itself.

But for now, this fixes a bug that occures when leaving (the viewed room would not change).
This prevents leaking of state that we do not want to share with the next user
@@ -61,6 +61,11 @@ class LifecycleStore extends Store {
});
dis.dispatch(deferredAction);
break;
case 'on_logged_out':
this._state = {
deferred_action: null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this duplication feels pretty ming and fragile, surely we should use the same pattern as RoomViewStore and have an INITIAL_STATE variable which gets copied over the top of this._state.

@@ -66,6 +66,11 @@ class SessionStore extends Store {
cachedPassword: null,
});
break;
case 'on_logged_out':
this._state = {
cachedPassword: null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this duplication feels pretty ming and fragile, surely we should use the same pattern as RoomViewStore and have an INITIAL_STATE variable which gets copied over the top of this._state.

@ara4n
Copy link
Member

ara4n commented May 26, 2017

a minor quibble - back atcha

@ara4n ara4n assigned lukebarnard1 and unassigned dbkr May 26, 2017
@lukebarnard1 lukebarnard1 assigned ara4n and unassigned lukebarnard1 May 26, 2017
@ara4n
Copy link
Member

ara4n commented May 26, 2017

lgtm

@ara4n ara4n merged commit 44f479c into new-guest-access May 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants