Updated HomeTimeline to reload on every mount

• Updated:
- HomeTimeline to reload on every mount
This commit is contained in:
mgabdev 2021-01-05 01:45:26 -05:00
parent 7a58d0fa58
commit 951e206091
1 changed files with 1 additions and 26 deletions

View File

@ -13,12 +13,10 @@ import StatusList from '../components/status_list'
class HomeTimeline extends React.PureComponent {
componentDidMount () {
this._checkIfReloadNeeded(false, this.props.isPartial)
this.props.onExpandHomeTimeline()
}
componentDidUpdate (prevProps) {
this._checkIfReloadNeeded(prevProps.isPartial, this.props.isPartial)
//Check if clicked on "home" button, if so, reload
if (prevProps.location.key !== this.props.location.key &&
prevProps.location.pathname === '/home' &&
@ -27,10 +25,6 @@ class HomeTimeline extends React.PureComponent {
}
}
componentWillUnmount () {
this._stopPolling()
}
handleLoadMore = (maxId) => {
this.props.onExpandHomeTimeline({ maxId })
}
@ -39,25 +33,6 @@ class HomeTimeline extends React.PureComponent {
this.props.onExpandHomeTimeline()
}, 5000)
_checkIfReloadNeeded (wasPartial, isPartial) {
const { onExpandHomeTimeline } = this.props
if (!wasPartial && isPartial) {
this.polling = setInterval(() => {
onExpandHomeTimeline()
}, 3000)
} else if (wasPartial && !isPartial) {
this._stopPolling()
}
}
_stopPolling () {
if (this.polling) {
clearInterval(this.polling)
this.polling = null
}
}
render () {
const { intl } = this.props