Fix missing code from "delay post list for animation frame" (#1497)

* Fix missing code from "delay post list for animation frame"

* fix

* move setState elsewhere

* update

* fix

* eslint

* remove some diff
This commit is contained in:
Michał Odziemczyk 2018-03-14 15:30:27 +01:00 committed by Harrison Healey
parent 39774f8c20
commit c20a01a0a2

View file

@ -54,6 +54,7 @@ export default class ChannelPostList extends PureComponent {
const {postIds: nextPostIds} = nextProps;
let visiblePostIds = this.state.visiblePostIds;
const channelSwitch = nextProps.channelId !== this.props.channelId;
if (nextPostIds !== this.props.postIds || nextProps.postVisibility !== this.props.postVisibility) {
visiblePostIds = this.getVisiblePostIds(nextProps);
@ -61,7 +62,12 @@ export default class ChannelPostList extends PureComponent {
this.setState({
visiblePostIds,
});
loading: channelSwitch,
}, () => InteractionManager.runAfterInteractions(() => {
if (channelSwitch) {
this.setState({loading: false});
}
}));
}
componentDidUpdate(prevProps) {