From 14804965b5a13f2ffef3d45c690f51d0d7ce810a Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Wed, 2 Dec 2015 10:22:39 -0500 Subject: Make proper async calls when switching channels --- web/react/utils/async_client.jsx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index 8cf111d55..1b7106974 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -106,10 +106,16 @@ export function getChannel(id) { ); } -export function updateLastViewedAt() { - const channelId = ChannelStore.getCurrentId(); +export function updateLastViewedAt(id) { + let channelId; + if (id) { + channelId = id; + } else { + channelId = ChannelStore.getCurrentId(); + } + console.log('start ' + channelId); - if (channelId === null) { + if (channelId == null) { return; } @@ -118,6 +124,7 @@ export function updateLastViewedAt() { } callTracker[`updateLastViewed${channelId}`] = utils.getTimestamp(); + console.log('call ' + channelId); client.updateLastViewedAt( channelId, () => { @@ -159,8 +166,13 @@ export function getMoreChannels(force) { } } -export function getChannelExtraInfo() { - const channelId = ChannelStore.getCurrentId(); +export function getChannelExtraInfo(id) { + let channelId; + if (id) { + channelId = id; + } else { + channelId = ChannelStore.getCurrentId(); + } if (channelId != null) { if (isCallInProgress('getChannelExtraInfo_' + channelId)) { -- cgit v1.2.3-1-g7c22