From b0091b23b9637c87a0d3472ccb04af0219e01280 Mon Sep 17 00:00:00 2001 From: Jakub Majorek Date: Wed, 25 Nov 2020 13:13:23 +0100 Subject: [PATCH] [1753] Update channel default choice on change --- .../components/ChannelPickerDialog/ChannelPickerDialog.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/channels/components/ChannelPickerDialog/ChannelPickerDialog.tsx b/src/channels/components/ChannelPickerDialog/ChannelPickerDialog.tsx index 2d1efdf00..90a89e91e 100644 --- a/src/channels/components/ChannelPickerDialog/ChannelPickerDialog.tsx +++ b/src/channels/components/ChannelPickerDialog/ChannelPickerDialog.tsx @@ -4,7 +4,8 @@ import { Choices, SingleSelectField } from "@saleor/components/SingleSelectField"; -import React, { useState } from "react"; +import useStateFromProps from "@saleor/hooks/useStateFromProps"; +import React from "react"; import { useIntl } from "react-intl"; import { useStyles } from "../styles"; @@ -28,7 +29,7 @@ const ChannelPickerDialog: React.FC = ({ }) => { const classes = useStyles({}); const intl = useIntl(); - const [choice, setChoice] = useState( + const [choice, setChoice] = useStateFromProps( defaultChoice || (!!channelsChoices.length ? channelsChoices[0].value : "") );