frontend: fix behavior when no channels are present

This commit is contained in:
hippoz 2022-04-27 23:41:50 +03:00
parent 34dc98af95
commit 6cfac8a6aa
No known key found for this signature in database
GPG key ID: 7C52899193467641
2 changed files with 5 additions and 3 deletions

View file

@ -26,10 +26,10 @@
{/if}
<div class="flex-container">
{#if $showSidebar}
{#if $showSidebar || $selectedChannel.id === -1}
<Sidebar />
{/if}
{#if !($smallViewport && $showSidebar) && $showChannelView}
{#if !($smallViewport && $showSidebar) && $showChannelView && $selectedChannel.id !== -1}
<ChannelView channel={$selectedChannel} />
{/if}
</div>

View file

@ -36,7 +36,9 @@ class ChannelsStore extends Store {
gateway.subscribe(GatewayEventType.Ready, ({ channels }) => {
this.value = channels;
selectedChannel.set(channels.length ? channels[0] : null);
if (channels.length >= 1) {
selectedChannel.set(channels[0]);
}
this.updated();
});
gateway.subscribe(GatewayEventType.ChannelCreate, (channel) => {