From 866a5da0f01a9e447b810f966480a43e4a7bc884 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 11 Apr 2023 21:42:39 -0700 Subject: [PATCH] Fix notification fetch abort condition --- src/state/models/feeds/notifications.ts | 6 ++++-- src/view/screens/Notifications.tsx | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/state/models/feeds/notifications.ts b/src/state/models/feeds/notifications.ts index 15ead4b0da..96563836f6 100644 --- a/src/state/models/feeds/notifications.ts +++ b/src/state/models/feeds/notifications.ts @@ -356,7 +356,9 @@ export class NotificationsFeedModel { } catch (e) { this.rootStore.log.error('NotificationsModel:processQueue failed', {e}) } finally { - this.isRefreshing = false + runInAction(() => { + this.isRefreshing = false + }) this.lock.release() } }) @@ -508,7 +510,7 @@ export class NotificationsFeedModel { } accRes.data.notifications.push(notif) } - if (pageIsDone) { + if (pageIsDone || res.data.notifications.length < PAGE_SIZE) { return accRes } } diff --git a/src/view/screens/Notifications.tsx b/src/view/screens/Notifications.tsx index 4bf84665bf..8fc47b248e 100644 --- a/src/view/screens/Notifications.tsx +++ b/src/view/screens/Notifications.tsx @@ -70,7 +70,6 @@ export const NotificationsScreen = withAuthRequired( onScroll={onMainScroll} scrollElRef={scrollElRef} /> - {store.me.notifications.hasNewLatest && !store.me.notifications.isRefreshing && (