Skip to content

Commit a24f41d

Browse files
Merge pull request #237 from GetStream/vishal/channellist-fix
Set active channel only on reload
2 parents 6959c69 + 84ded29 commit a24f41d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/components/ChannelList.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,13 @@ const ChannelList = withChatContext(
284284
});
285285

286286
queryChannelsRequest = async (filters, sort, options, retryCount = 1) => {
287-
const channelPromise = this.props.client.queryChannels(
288-
filters,
289-
sort,
290-
options,
291-
);
292-
293287
let channelQueryResponse;
294-
295288
try {
296-
channelQueryResponse = await channelPromise;
289+
channelQueryResponse = await this.props.client.queryChannels(
290+
filters,
291+
sort,
292+
options,
293+
);
297294
} catch (e) {
298295
// Wait for 2 seconds before making another attempt
299296
await this.wait(2000);
@@ -413,7 +410,8 @@ const ChannelList = withChatContext(
413410
options,
414411
);
415412

416-
if (options.offset === 0 && channelQueryResponse.length >= 1) {
413+
// Set the active channel only in case of reload.
414+
if (queryType === 'reload' && channelQueryResponse.length >= 1) {
417415
this.props.setActiveChannel(channelQueryResponse[0]);
418416
}
419417

0 commit comments

Comments
 (0)