frontend: fallback to first channel if the selected channel cant be found

This commit is contained in:
hippoz 2022-05-06 02:56:22 +03:00
parent 0a17ea2ac6
commit d837dbddb4
Signed by: hippoz
GPG key ID: 7C52899193467641

View file

@ -49,6 +49,8 @@ class ChannelsStore extends Store {
const index = this.value.findIndex(e => e.id === selectedChannel.value.id);
if (index !== -1)
selectedChannel.set(this.value[index]);
else // if the channel doesn't exist, just select the first one
selectedChannel.set(channels[0]);
}
}
this.updated();