Set a page-size on notifications

This commit is contained in:
Paul Frazee 2022-11-28 10:22:52 -06:00
parent bcb1ad98de
commit c86ff23757

View file

@ -7,7 +7,7 @@ import {APP_BSKY_GRAPH} from '../../third-party/api'
import {cleanError} from '../../lib/strings' import {cleanError} from '../../lib/strings'
const UNGROUPABLE_REASONS = ['trend', 'assertion'] const UNGROUPABLE_REASONS = ['trend', 'assertion']
const PAGE_SIZE = 30
const MS_60MIN = 1e3 * 60 * 60 const MS_60MIN = 1e3 * 60 * 60
export interface GroupedNotification extends ListNotifications.Notification { export interface GroupedNotification extends ListNotifications.Notification {
@ -242,9 +242,10 @@ export class NotificationsViewModel {
private async _initialLoad(isRefreshing = false) { private async _initialLoad(isRefreshing = false) {
this._xLoading(isRefreshing) this._xLoading(isRefreshing)
try { try {
const res = await this.rootStore.api.app.bsky.notification.list( const params = Object.assign({}, this.params, {
this.params, limit: PAGE_SIZE,
) })
const res = await this.rootStore.api.app.bsky.notification.list(params)
this._replaceAll(res) this._replaceAll(res)
this._xIdle() this._xIdle()
} catch (e: any) { } catch (e: any) {
@ -259,6 +260,7 @@ export class NotificationsViewModel {
this._xLoading() this._xLoading()
try { try {
const params = Object.assign({}, this.params, { const params = Object.assign({}, this.params, {
limit: PAGE_SIZE,
before: this.loadMoreCursor, before: this.loadMoreCursor,
}) })
const res = await this.rootStore.api.app.bsky.notification.list(params) const res = await this.rootStore.api.app.bsky.notification.list(params)