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 {
|
class HomeTimeline extends React.PureComponent {
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
this._checkIfReloadNeeded(false, this.props.isPartial)
|
this.props.onExpandHomeTimeline()
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate (prevProps) {
|
componentDidUpdate (prevProps) {
|
||||||
this._checkIfReloadNeeded(prevProps.isPartial, this.props.isPartial)
|
|
||||||
|
|
||||||
//Check if clicked on "home" button, if so, reload
|
//Check if clicked on "home" button, if so, reload
|
||||||
if (prevProps.location.key !== this.props.location.key &&
|
if (prevProps.location.key !== this.props.location.key &&
|
||||||
prevProps.location.pathname === '/home' &&
|
prevProps.location.pathname === '/home' &&
|
||||||
@ -27,10 +25,6 @@ class HomeTimeline extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
|
||||||
this._stopPolling()
|
|
||||||
}
|
|
||||||
|
|
||||||
handleLoadMore = (maxId) => {
|
handleLoadMore = (maxId) => {
|
||||||
this.props.onExpandHomeTimeline({ maxId })
|
this.props.onExpandHomeTimeline({ maxId })
|
||||||
}
|
}
|
||||||
@ -39,25 +33,6 @@ class HomeTimeline extends React.PureComponent {
|
|||||||
this.props.onExpandHomeTimeline()
|
this.props.onExpandHomeTimeline()
|
||||||
}, 5000)
|
}, 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 () {
|
render () {
|
||||||
const { intl } = this.props
|
const { intl } = this.props
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user