From f82667f3b86202dafff3a2a4ea56aec74c80316d Mon Sep 17 00:00:00 2001 From: enahum Date: Thu, 27 Oct 2016 12:24:30 -0300 Subject: PLT-4430 improve slow channel switching (#4331) * PLT-4430 improve slow channel switching * Update client side unit tests * Convert getChannelsUnread to getMyChannelMembers and address other feedback * Pull channel members on websocket reconnect --- webapp/actions/global_actions.jsx | 6 ------ webapp/actions/post_actions.jsx | 2 +- webapp/actions/websocket_actions.jsx | 1 + 3 files changed, 2 insertions(+), 7 deletions(-) (limited to 'webapp/actions') diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index 23ff5a295..123c1c392 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -42,8 +42,6 @@ export function emitChannelClickEvent(channel) { ); } function switchToChannel(chan) { - AsyncClient.getChannels(true); - AsyncClient.getMoreChannels(true); AsyncClient.getChannelStats(chan.id); AsyncClient.updateLastViewedAt(chan.id); loadPosts(chan.id); @@ -436,10 +434,6 @@ export function loadDefaultLocale() { } export function viewLoggedIn() { - AsyncClient.getChannels(); - AsyncClient.getMoreChannels(); - AsyncClient.getChannelStats(); - // Clear pending posts (shouldn't have pending posts if we are loading) PostStore.clearPendingPosts(); } diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx index 462576021..1a2056a2e 100644 --- a/webapp/actions/post_actions.jsx +++ b/webapp/actions/post_actions.jsx @@ -120,7 +120,7 @@ export function setUnreadPost(channelId, postId) { member.msg_count = channel.total_msg_count - unreadPosts; member.mention_count = 0; ChannelStore.storeMyChannelMember(member); - ChannelStore.setUnreadCount(channelId); + ChannelStore.setUnreadCountByChannel(channelId); AsyncClient.setLastViewedAt(lastViewed, channelId); } diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index c3a3010b0..e58bded0d 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -76,6 +76,7 @@ function handleFirstConnect() { function handleReconnect() { if (Client.teamId) { AsyncClient.getChannels(); + AsyncClient.getMyChannelMembers(); loadPosts(ChannelStore.getCurrentId()); } -- cgit v1.2.3-1-g7c22