diff --git a/apps/meteor/app/ui-utils/client/lib/openRoom.js b/apps/meteor/app/ui-utils/client/lib/openRoom.js index 212f63391d00..03bd35c48a67 100644 --- a/apps/meteor/app/ui-utils/client/lib/openRoom.js +++ b/apps/meteor/app/ui-utils/client/lib/openRoom.js @@ -72,7 +72,7 @@ export const openRoom = async function (type, name, render = true) { // update user's room subscription const sub = ChatSubscription.findOne({ rid: room._id }); if (sub && sub.open === false) { - callWithErrorHandling('openRoom', room._id); + await callWithErrorHandling('openRoom', room._id); } if (FlowRouter.getQueryParam('msg')) { diff --git a/apps/meteor/app/ui/client/views/app/room.js b/apps/meteor/app/ui/client/views/app/room.js index dddbed3f4ce4..7087e7a148e2 100644 --- a/apps/meteor/app/ui/client/views/app/room.js +++ b/apps/meteor/app/ui/client/views/app/room.js @@ -934,16 +934,18 @@ Meteor.startup(() => { }, 500); this.autorun(() => { - if (rid !== Session.get('openedRoom')) { - return; - } + Tracker.afterFlush(() => { + if (rid !== Session.get('openedRoom')) { + return; + } - let room = Rooms.findOne({ _id: rid }, { fields: { t: 1 } }); + let room = Rooms.findOne({ _id: rid }, { fields: { t: 1 } }); - if (room?.t === 'l') { - room = Tracker.nonreactive(() => Rooms.findOne({ _id: rid })); - roomCoordinator.getRoomDirectives(room.t)?.openCustomProfileTab(this, room, room.v.username); - } + if (room?.t === 'l') { + room = Tracker.nonreactive(() => Rooms.findOne({ _id: rid })); + roomCoordinator.getRoomDirectives(room.t)?.openCustomProfileTab(this, room, room.v.username); + } + }); }); this.autorun(() => {