Merge pull request #8514 from RocketChat/hotfix/uncessary-route-reload

[FIX] Uncessary route reload break some routes
pull/8518/head
Rodrigo Nascimento 8 years ago
parent a38d9174ee
commit ddd6a735bb
No known key found for this signature in database
GPG Key ID: CFCE33B7B01AC335
  1. 7
      packages/rocketchat-ui/client/lib/RoomManager.js

@ -265,7 +265,12 @@ Meteor.startup(() => {
if ((currentUsername === undefined) && ((user != null ? user.username : undefined) != null)) {
currentUsername = user.username;
RoomManager.closeAllRooms();
FlowRouter.reload();
const roomTypes = RocketChat.roomTypes.roomTypes;
// Reload only if the current route is a channel route
const roomType = Object.keys(roomTypes).find(key => roomTypes[key].route && roomTypes[key].route.name === FlowRouter.current().route.name);
if (roomType) {
FlowRouter.reload();
}
}
});

Loading…
Cancel
Save