Do not show a loading spinner if thread has root post loaded (#2186)
* Do not show a loading spinner if thread has root post loaded * Feedback review * Remove additional condition
This commit is contained in:
parent
bf36a7533e
commit
093484eab3
1 changed files with 15 additions and 11 deletions
|
|
@ -86,16 +86,21 @@ class Thread extends PureComponent {
|
|||
|
||||
hasRootPost = () => {
|
||||
return this.props.postIds.includes(this.props.rootId);
|
||||
}
|
||||
};
|
||||
|
||||
renderFooter = () => {
|
||||
if (!this.hasRootPost() && this.props.threadLoadingStatus.status !== RequestStatus.STARTED) {
|
||||
return (
|
||||
<DeletedPost theme={this.props.theme}/>
|
||||
);
|
||||
} else if (this.props.threadLoadingStatus.status === RequestStatus.STARTED) {
|
||||
return (
|
||||
<Loading/>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
onCloseChannel = () => {
|
||||
this.props.navigator.resetTo({
|
||||
|
|
@ -112,7 +117,7 @@ class Thread extends PureComponent {
|
|||
screenBackgroundColor: 'transparent',
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
|
|
@ -126,11 +131,8 @@ class Thread extends PureComponent {
|
|||
} = this.props;
|
||||
const style = getStyle(theme);
|
||||
let content;
|
||||
if (this.props.threadLoadingStatus.status === RequestStatus.STARTED) {
|
||||
content = (
|
||||
<Loading/>
|
||||
);
|
||||
} else {
|
||||
let postTextBox;
|
||||
if (this.hasRootPost()) {
|
||||
content = (
|
||||
<PostList
|
||||
renderFooter={this.renderFooter}
|
||||
|
|
@ -141,9 +143,7 @@ class Thread extends PureComponent {
|
|||
navigator={navigator}
|
||||
/>
|
||||
);
|
||||
}
|
||||
let postTextBox;
|
||||
if (this.hasRootPost() && this.props.threadLoadingStatus.status !== RequestStatus.STARTED) {
|
||||
|
||||
postTextBox = (
|
||||
<PostTextbox
|
||||
channelIsArchived={channelIsArchived}
|
||||
|
|
@ -153,6 +153,10 @@ class Thread extends PureComponent {
|
|||
onCloseChannel={this.onCloseChannel}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
content = (
|
||||
<Loading/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue