Safely parse first channel from the list, if no channels exist (#196)
This commit is contained in:
parent
63275866a1
commit
4e4257d788
3 changed files with 8 additions and 2 deletions
6
.changeset/dull-items-bake.md
Normal file
6
.changeset/dull-items-bake.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
"saleor-app-products-feed": patch
|
||||
"saleor-app-invoices": patch
|
||||
---
|
||||
|
||||
Ensure initially selected channel will not crash if no channels exist
|
|
@ -48,7 +48,7 @@ export const ChannelsConfiguration = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (channels.isSuccess) {
|
||||
setActiveChannelSlug(channels.data![0].slug ?? null);
|
||||
setActiveChannelSlug(channels.data![0]?.slug ?? null);
|
||||
}
|
||||
}, [channels.isSuccess, channels.data]);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ export const ChannelsConfiguration = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (channels.isSuccess) {
|
||||
setActiveChannelSlug(channels.data![0].slug ?? null);
|
||||
setActiveChannelSlug(channels.data![0]?.slug ?? null);
|
||||
}
|
||||
}, [channels.isSuccess, channels.data]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue