From 01b1bf237d1b535792eea43bf25c6093f4d5af0b Mon Sep 17 00:00:00 2001 From: Filipe Marins Date: Mon, 18 Apr 2022 12:07:17 -0300 Subject: [PATCH] refactor: load from server all chatsubscription before open room --- apps/meteor/app/ui-utils/client/lib/openRoom.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/meteor/app/ui-utils/client/lib/openRoom.js b/apps/meteor/app/ui-utils/client/lib/openRoom.js index 8699d91202bba..e3f00d82f7107 100644 --- a/apps/meteor/app/ui-utils/client/lib/openRoom.js +++ b/apps/meteor/app/ui-utils/client/lib/openRoom.js @@ -12,7 +12,7 @@ import { callWithErrorHandling } from '../../../../client/lib/utils/callWithErro import { call } from '../../../../client/lib/utils/call'; import { RoomManager, RoomHistoryManager } from '..'; import { RoomManager as NewRoomManager } from '../../../../client/lib/RoomManager'; -import { Rooms } from '../../../models/client'; +import { CachedChatSubscription, Rooms } from '../../../models/client'; import { fireGlobalEvent } from '../../../../client/lib/utils/fireGlobalEvent'; import { roomCoordinator } from '../../../../client/lib/rooms/roomCoordinator'; @@ -96,6 +96,7 @@ export const openRoom = async function (type, name, render = true) { if (type === 'd') { try { const { rid } = await call('createDirectMessage', ...name.split(', ')); + CachedChatSubscription.loadFromServerAndPopulate(); return FlowRouter.go('direct', { rid }, FlowRouter.current().queryParams); } catch (error) { console.error(error);