Fixed issue with loading in Notifications

• Fixed:
- issue with loading in Notifications
This commit is contained in:
mgabdev 2020-07-15 23:01:49 -05:00
parent 98e996ef54
commit 15c7ff1eba

View File

@ -57,6 +57,10 @@ class Notifications extends ImmutablePureComponent {
selectedFilter: PropTypes.string.isRequired,
}
state = {
changedTabs: false,
}
componentWillUnmount() {
this.handleLoadOlder.cancel()
this.handleScrollToTop.cancel()
@ -69,13 +73,21 @@ class Notifications extends ImmutablePureComponent {
this.props.onScrollTopNotifications(true)
}
componentDidUpdate (prevProps) {
componentDidUpdate (prevProps, prevState) {
//Check if clicked on "notifications" button, if so, reload
if (prevProps.location.key !== this.props.location.key &&
prevProps.location.pathname === '/notifications' &&
this.props.location.pathname === '/notifications') {
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(() => {
@ -107,8 +119,9 @@ class Notifications extends ImmutablePureComponent {
totalQueuedNotificationsCount,
selectedFilter,
} = this.props
const { changedTabs } = this.state
if (isLoading) {
if (isLoading && changedTabs) {
return <ColumnIndicator type='loading' />
}