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:
parent
8e9b8b6b36
commit
38d78e16bf
7 changed files with 81 additions and 18 deletions
|
@ -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 = ''
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue