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) {
fetchChannelListMine();
}
this.setState({ currentSelectedValue: channelName });
}
componentDidUpdate() {
const { channelName } = this.props;
if (this.state.currentSelectedValue !== channelName) {
componentWillReceiveProps(nextProps) {
const { channels: prevChannels = [], channelName } = this.props;
const { channels = [] } = nextProps;
if (channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) {
this.setState({ currentSelectedValue: channelName });
}
}