aboutsummaryrefslogtreecommitdiff
path: root/src/services/notifications_fetcher
diff options
context:
space:
mode:
authorShpuld Shpuldson <shp@cock.li>2020-07-01 14:15:04 +0300
committerShpuld Shpuldson <shp@cock.li>2020-07-01 14:15:04 +0300
commit62d0bc47b333135f31abea90b4f5a3c28e608733 (patch)
treeea042aa5177e4b7c6df3a20bfcb0922c3948cfb0 /src/services/notifications_fetcher
parent82944f862d07db46cf342f2ee75b2ab6ddccc4fc (diff)
remove unnecessary fetchAndUpdate, change notifications fetcher to not double fetch
Diffstat (limited to 'src/services/notifications_fetcher')
-rw-r--r--src/services/notifications_fetcher/notifications_fetcher.service.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js
index 64499a1b..581931f5 100644
--- a/src/services/notifications_fetcher/notifications_fetcher.service.js
+++ b/src/services/notifications_fetcher/notifications_fetcher.service.js
@@ -31,8 +31,11 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => {
const notifications = timelineData.data
const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id)
if (readNotifsIds.length) {
- args['since'] = Math.max(...readNotifsIds)
- fetchNotifications({ store, args, older })
+ const possibleMax = Math.max(...readNotifsIds)
+ if (possibleMax !== timelineData.maxId) {
+ args['since'] = possibleMax
+ fetchNotifications({ store, args, older })
+ }
}
return result