diff --git a/src/createRoom.ts b/src/createRoom.ts index 8e392609211..e819bf39af4 100644 --- a/src/createRoom.ts +++ b/src/createRoom.ts @@ -316,9 +316,6 @@ export default async function createRoom(client: MatrixClient, opts: IOpts): Pro return Promise.reject(err); } }) - .finally(function () { - if (modal) modal.close(); - }) .then(async (res): Promise => { roomId = res.room_id; @@ -340,6 +337,9 @@ export default async function createRoom(client: MatrixClient, opts: IOpts): Pro if (opts.dmUserId) await Rooms.setDMRoom(client, roomId, opts.dmUserId); }) + .finally(function () { + if (modal) modal.close(); + }) .then(() => { if (opts.parentSpace) { return SpaceStore.instance.addRoomToSpace(