Search custom feeds (#1031)

* paginate custom feeds

* basic search

* update `@atproto/api`

* use search from the API

* debounce search for 200ms
This commit is contained in:
Ansh 2023-07-28 08:29:37 -07:00 committed by GitHub
parent 8e9b8b6b36
commit 38d78e16bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 81 additions and 18 deletions

View file

@ -82,6 +82,21 @@ export class FeedsDiscoveryModel {
this._xIdle()
})
search = async (query: string) => {
this._xLoading(false)
try {
const results =
await this.rootStore.agent.app.bsky.unspecced.getPopularFeedGenerators({
limit: DEFAULT_LIMIT,
query: query,
})
this._replaceAll(results)
} catch (e: any) {
this._xIdle(e)
}
this._xIdle()
}
clear() {
this.isLoading = false
this.isRefreshing = false
@ -93,9 +108,9 @@ export class FeedsDiscoveryModel {
// state transitions
// =
_xLoading() {
_xLoading(isRefreshing = true) {
this.isLoading = true
this.isRefreshing = true
this.isRefreshing = isRefreshing
this.error = ''
}