Improve behavior of load more notifications btn

This commit is contained in:
Paul Frazee
2023-04-11 18:36:58 -07:00
parent 33f5ebf2de
commit 9be8867bc9
+8 -4
View File
@@ -314,7 +314,7 @@ export class NotificationsFeedModel {
*/
syncQueue = bundleAsync(async () => {
this.rootStore.log.debug('NotificationsModel:syncQueue')
this.lock.acquireAsync()
await this.lock.acquireAsync()
try {
const res = await this._fetchUntil(
notif =>
@@ -340,9 +340,12 @@ export class NotificationsFeedModel {
if (!this.queuedNotifications) {
return
}
this.lock.acquireAsync()
this.isRefreshing = true
await this.lock.acquireAsync()
try {
this.mostRecentNotificationUri = this.queuedNotifications[0].uri
runInAction(() => {
this.mostRecentNotificationUri = this.queuedNotifications?.[0].uri
})
const itemModels = await this._processNotifications(
this.queuedNotifications,
)
@@ -353,6 +356,7 @@ export class NotificationsFeedModel {
} catch (e) {
this.rootStore.log.error('NotificationsModel:processQueue failed', {e})
} finally {
this.isRefreshing = false
this.lock.release()
}
})
@@ -364,7 +368,7 @@ export class NotificationsFeedModel {
if (!this.hasMore) {
return
}
this.lock.acquireAsync()
await this.lock.acquireAsync()
try {
this._xLoading()
try {