Put back code
with comment hopefully explaining why it's necessary
This commit is contained in:
parent
9d247321f5
commit
aaf0c7d269
1 changed files with 7 additions and 0 deletions
|
@ -35,6 +35,13 @@ export abstract class AsyncStoreWithClient<T extends Object> extends AsyncStore<
|
||||||
await this.onAction(payload);
|
await this.onAction(payload);
|
||||||
|
|
||||||
if (payload.action === 'MatrixActions.sync') {
|
if (payload.action === 'MatrixActions.sync') {
|
||||||
|
// Only set the client on the transition into the PREPARED state.
|
||||||
|
// Everything after this is unnecessary (we only need to know once we have a client)
|
||||||
|
// and we intentionally don't set the client before this point to avoid stores
|
||||||
|
// updating for every event emitted during the cached sync.
|
||||||
|
if (!(payload.prevState === 'PREPARED' && payload.state !== 'PREPARED')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.matrixClient = payload.matrixClient;
|
this.matrixClient = payload.matrixClient;
|
||||||
await this.onReady();
|
await this.onReady();
|
||||||
} else if (payload.action === 'on_client_not_viable' || payload.action === 'on_logged_out') {
|
} else if (payload.action === 'on_client_not_viable' || payload.action === 'on_logged_out') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue