From 54030dcba93ef4538f261adcd383fc956696db30 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Mon, 26 Jun 2023 13:44:55 +0300 Subject: [PATCH] fix community channel selection --- frontend/src/stores.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/stores.js b/frontend/src/stores.js index 4ab22ae..8261e06 100644 --- a/frontend/src/stores.js +++ b/frontend/src/stores.js @@ -698,10 +698,10 @@ class SelectedChannelStore extends Store { this.communityIdToSelectedChannel = new Map(); - selectedCommunity.subscribe((community) => { - let channel = this.communityIdToSelectedChannel.get(community.id); - if (!channel && filteredChannelsStore.value.length) { - channel = filteredChannelsStore.value[0]; + filteredChannelsStore.subscribe((channels) => { + let channel = this.communityIdToSelectedChannel.get(selectedCommunity.value.id); + if (!channel && channels.length) { + channel = channels[0]; } this.value = channel || noneChannel; this.updated(); @@ -716,9 +716,7 @@ class SelectedChannelStore extends Store { this.communityIdToSelectedChannel.set(parseInt(communityId), channel); } } - this.value = this.communityIdToSelectedChannel.get(selectedCommunity.value.id) || noneChannel; this.updateSavedMap(); - this.updated(); }); gateway.subscribe(GatewayEventType.CommunityDelete, ({ id }) => { if (this.communityIdToSelectedChannel.delete(id) && this.value && this.value.id === id) {