guard againsts >25 items

This commit is contained in:
Samuel Newman
2025-07-01 08:38:50 +03:00
parent d51be0cd90
commit 89314adafd
3 changed files with 11 additions and 3 deletions
+9 -1
View File
@@ -4,6 +4,7 @@ import {
type AppBskyFeedGetPosts,
} from '@atproto/api'
import {logger} from '#/logger'
import {type FeedAPI, type FeedAPIResponse} from './types'
export class PostListFeedAPI implements FeedAPI {
@@ -19,7 +20,14 @@ export class PostListFeedAPI implements FeedAPI {
feedParams: AppBskyFeedGetPosts.QueryParams
}) {
this.agent = agent
this.params = feedParams
if (feedParams.uris.length > 25) {
logger.warn(
`Too many URIs provided - expected 25, got ${feedParams.uris.length}`,
)
}
this.params = {
uris: feedParams.uris.slice(0, 25),
}
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
+1 -1
View File
@@ -33,10 +33,10 @@ export function NotificationsActivityListScreen({
</Layout.Header.Outer>
<PostFeed
feed={`posts|${uris}`}
disablePoll
renderEmptyState={() => (
<EmptyState icon="growth" message={_(msg`No posts here`)} />
)}
disablePoll
renderEndOfFeed={() => <ListFooter />}
/>
</Layout.Screen>
@@ -134,7 +134,7 @@ let NotificationFeedItem = ({
for (const post of [item.notification, ...(item.additional ?? [])]) {
posts.push(post.uri)
}
return `/notifications/activity?posts=${encodeURIComponent(posts.join(','))}`
return `/notifications/activity?posts=${encodeURIComponent(posts.slice(0, 25).join(','))}`
}
}