Fixed issue with loading in Notifications
• Fixed: - issue with loading in Notifications
This commit is contained in:
parent
98e996ef54
commit
15c7ff1eba
@ -57,6 +57,10 @@ class Notifications extends ImmutablePureComponent {
|
|||||||
selectedFilter: PropTypes.string.isRequired,
|
selectedFilter: PropTypes.string.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state = {
|
||||||
|
changedTabs: false,
|
||||||
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.handleLoadOlder.cancel()
|
this.handleLoadOlder.cancel()
|
||||||
this.handleScrollToTop.cancel()
|
this.handleScrollToTop.cancel()
|
||||||
@ -69,13 +73,21 @@ class Notifications extends ImmutablePureComponent {
|
|||||||
this.props.onScrollTopNotifications(true)
|
this.props.onScrollTopNotifications(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate (prevProps) {
|
componentDidUpdate (prevProps, prevState) {
|
||||||
//Check if clicked on "notifications" button, if so, reload
|
//Check if clicked on "notifications" button, if so, reload
|
||||||
if (prevProps.location.key !== this.props.location.key &&
|
if (prevProps.location.key !== this.props.location.key &&
|
||||||
prevProps.location.pathname === '/notifications' &&
|
prevProps.location.pathname === '/notifications' &&
|
||||||
this.props.location.pathname === '/notifications') {
|
this.props.location.pathname === '/notifications') {
|
||||||
this.handleReload()
|
this.handleReload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prevProps.selectedFilter !== this.props.selectedFilter) {
|
||||||
|
this.setState({ changedTabs: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevProps.selectedFilter === this.props.selectedFilter && prevState.changedTabs) {
|
||||||
|
this.setState({ changedTabs: false })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleReload = throttle(() => {
|
handleReload = throttle(() => {
|
||||||
@ -107,8 +119,9 @@ class Notifications extends ImmutablePureComponent {
|
|||||||
totalQueuedNotificationsCount,
|
totalQueuedNotificationsCount,
|
||||||
selectedFilter,
|
selectedFilter,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
const { changedTabs } = this.state
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading && changedTabs) {
|
||||||
return <ColumnIndicator type='loading' />
|
return <ColumnIndicator type='loading' />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user