Fix no channels crash (#984)

* Fix crash caused by not having any channels

* Update changelog
This commit is contained in:
Dominik Żegleń 2021-02-18 14:05:39 +01:00 committed by GitHub
parent 1bf9254428
commit afa228fd6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -19,6 +19,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Drop descriptionJson and contentJson fields - #950 by @jwm0
- Add error tracking with Sentry adapter - #956 by @jwm0
- Add OAuth2 login with OpenID support - #963 by @orzechdev
- Fix no channels crash - #984 by @dominik-zeglen
# 2.11.1

View file

@ -33,7 +33,7 @@ export const AppChannelProvider: React.FC = ({ children }) => {
const [isPickerActive, setPickerActive] = React.useState(false);
React.useEffect(() => {
if (!selectedChannel && channelData?.channels) {
if (!selectedChannel && channelData?.channels?.length > 0) {
setSelectedChannel(channelData.channels[0].id);
}
}, [channelData]);