fix channel selector issues on publish page

This commit is contained in:
Akinwale Ariwodola 2019-09-13 08:48:33 +01:00
parent 34fa24ffd0
commit 1678731601

View file

@ -30,11 +30,14 @@ export default class ChannelSelector extends React.PureComponent {
if (!channels.length && !fetchingChannels) { if (!channels.length && !fetchingChannels) {
fetchChannelListMine(); fetchChannelListMine();
} }
this.setState({ currentSelectedValue: channelName });
} }
componentDidUpdate() { componentWillReceiveProps(nextProps) {
const { channelName } = this.props; const { channels: prevChannels = [], channelName } = this.props;
if (this.state.currentSelectedValue !== channelName) { const { channels = [] } = nextProps;
if (channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) {
this.setState({ currentSelectedValue: channelName }); this.setState({ currentSelectedValue: channelName });
} }
} }