Updated HomeTimeline to reload on every mount
• Updated: - HomeTimeline to reload on every mount
This commit is contained in:
parent
7a58d0fa58
commit
951e206091
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue