Fixed issue with loading status context/comments in feature
• Fixed: - issue with loading status context/comments in feature
This commit is contained in:
parent
92c4fa3fda
commit
ae5d892221
@ -42,20 +42,30 @@ class Status extends ImmutablePureComponent {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const statusId = this.props.id || this.props.params.statusId
|
const statusId = this.props.id || this.props.params.statusId
|
||||||
this.props.onFetchStatus(statusId)
|
this.props.onFetchStatus(statusId)
|
||||||
|
|
||||||
|
if (!!this.props.status) {
|
||||||
|
this.shouldFetchStatusParts(this.props.status)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
const { status } = this.props
|
const { status } = this.props
|
||||||
|
|
||||||
if (prevProps.status !== status && !!status) {
|
if (prevProps.status !== status && !!status) {
|
||||||
const isComment = !!status.get('in_reply_to_account_id')
|
this.shouldFetchStatusParts(status)
|
||||||
const hasComments = status.get('replies_count') > 0
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isComment) {
|
shouldFetchStatusParts = (status) => {
|
||||||
this.props.onFetchContext(status.get('id'))
|
if (!status) return
|
||||||
} else if (!isComment && hasComments) {
|
|
||||||
this.props.onFetchComments(status.get('id'))
|
const isComment = !!status.get('in_reply_to_account_id')
|
||||||
}
|
const hasComments = status.get('replies_count') > 0
|
||||||
|
|
||||||
|
if (isComment) {
|
||||||
|
this.props.onFetchContext(status.get('id'))
|
||||||
|
} else if (!isComment && hasComments) {
|
||||||
|
this.props.onFetchComments(status.get('id'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user