Skip to content

Commit eaca582

Browse files
committed
fix awaiting for room state with and without new UpdateState method.
1 parent e2b0e02 commit eaca582

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/embedded.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ export class RoomWidgetClient extends MatrixClient {
289289

290290
await this.widgetApiReady;
291291

292-
if (!(await this.supportUpdateState())) {
292+
// sync room state:
293+
if (await this.supportUpdateState()) {
294+
// This will resolve once the client driver has sent us all the allowed room state.
295+
await this.roomStateSynced;
296+
} else {
293297
// Backfill the requested events
294298
// We only get the most recent event for every type + state key combo,
295299
// so it doesn't really matter what order we inject them in
@@ -320,8 +324,6 @@ export class RoomWidgetClient extends MatrixClient {
320324
}, 1000 * opts.clientWellKnownPollPeriod);
321325
this.fetchClientWellKnown();
322326
}
323-
324-
await this.roomStateSynced;
325327
this.setSyncState(SyncState.Syncing);
326328
logger.info("Finished initial sync");
327329

0 commit comments

Comments
 (0)