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

Make ActiveWidgetStore clear persistent widgets #2084

Merged
merged 5 commits into from
Jul 24, 2018

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Jul 24, 2018

ActiveWidgetStore is now reponsible for removing the current
persistent widget from the store if it's been removed from whatever
room it was in. As per comment, this leaves us with the store updating
itself in this case but in all other cases, views call setters on the
store to update its state. We should make it so the store keeps itself
up to date and views aren't responsible for keeping the store up to date.

The store now emits events so it can notify PersistentApp when it changes.

Fixes element-hq/element-web#7076
Based on #2081

dbkr added 2 commits July 23, 2018 17:11
ActiveWidgetStore is now reponsible for removing the current
persistent widget from the store if it's been removed from whatever
room it was in. As per comment, this leaves us with the store updating
itself in this case but in all other cases, views call setters on the
store to update its state. We should make it so the store keeps itself
up to date and views aren't responsible for keeping the store up to date.

The store now emits events so it can notify PersistentApp when it changes.

Fixes element-hq/element-web#7076
@dbkr dbkr requested a review from a team July 24, 2018 15:27
}
}

_destroyPersistentWidget() {
Copy link
Contributor

Choose a reason for hiding this comment

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

seems duplicated with ActiveWidgetStore::onRoomStateEvents. Have a single public method in ActiveWidgetStore that does this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, was on the fence about whether to do this now or leave it until moving more stuff to the store, but probably better to do it now.

src/Lifecycle.js Outdated
@@ -488,6 +490,7 @@ export function stopMatrixClient() {
Notifier.stop();
UserActivity.stop();
Presence.stop();
ActiveWidgetStore.start();
Copy link
Contributor

Choose a reason for hiding this comment

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

this should probably be stop()

@bwindels
Copy link
Contributor

@dbkr Test failed before on:

     TypeError: Cannot read property 'on' of null
    at ActiveWidgetStore.start (test/src/stores/ActiveWidgetStore.js:51:30 <- test/all-tests.js:174459:45)

Probably still do

@dbkr dbkr merged commit c19a5bd into develop Jul 24, 2018
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.

2 participants