about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-01-20 10:39:00 -0600
committerPaul Frazee <pfrazee@gmail.com>2023-01-20 10:39:00 -0600
commitd4b9ef3b0a89f1a5a97ff37024fe7f8d90891b86 (patch)
tree9c6bf6384d845aa63fe699d78a80e0b4fc977e81
parentc4cca8cf6c62b55296cfaca2ddd22606af6586a1 (diff)
downloadvoidsky-d4b9ef3b0a89f1a5a97ff37024fe7f8d90891b86.tar.zst
Only use cursors supplied by the server (ref #59)
-rw-r--r--src/state/models/feed-view.ts6
-rw-r--r--src/state/models/notifications-view.ts4
-rw-r--r--src/state/models/user-follows-view.ts2
3 files changed, 5 insertions, 7 deletions
diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts
index 710d374b8..a1647518b 100644
--- a/src/state/models/feed-view.ts
+++ b/src/state/models/feed-view.ts
@@ -438,10 +438,8 @@ export class FeedModel {
         }
         this._updateAll(res)
         numToFetch -= res.data.feed.length
-        cursor = this.feed[res.data.feed.length - 1]
-          ? ts(this.feed[res.data.feed.length - 1])
-          : undefined
-      } while (numToFetch > 0)
+        cursor = res.data.cursor
+      } while (cursor && numToFetch > 0)
       this._xIdle()
     } catch (e: any) {
       this._xIdle(e)
diff --git a/src/state/models/notifications-view.ts b/src/state/models/notifications-view.ts
index bbd7c8080..965efb87d 100644
--- a/src/state/models/notifications-view.ts
+++ b/src/state/models/notifications-view.ts
@@ -379,8 +379,8 @@ export class NotificationsViewModel {
         }
         this._updateAll(res)
         numToFetch -= res.data.notifications.length
-        cursor = this.notifications[res.data.notifications.length - 1].indexedAt
-      } while (numToFetch > 0)
+        cursor = res.data.cursor
+      } while (cursor && numToFetch > 0)
       this._xIdle()
     } catch (e: any) {
       this._xIdle(e)
diff --git a/src/state/models/user-follows-view.ts b/src/state/models/user-follows-view.ts
index 40f12b43e..d43a10c75 100644
--- a/src/state/models/user-follows-view.ts
+++ b/src/state/models/user-follows-view.ts
@@ -1,6 +1,6 @@
 import {makeAutoObservable} from 'mobx'
 import {
-  AppBskyGraphGetFollowers as GetFollows,
+  AppBskyGraphGetFollows as GetFollows,
   AppBskyActorRef as ActorRef,
 } from '@atproto/api'
 import {RootStoreModel} from './root-store'