Remove prefetch of feed (it wasnt working)

zio/stable
Paul Frazee 2022-12-19 19:16:56 -06:00
parent 7b974acc7a
commit 0d7385a41a
1 changed files with 2 additions and 16 deletions

View File

@ -205,7 +205,6 @@ export class FeedModel {
_loadMorePromise: Promise<void> | undefined
_loadLatestPromise: Promise<void> | undefined
_updatePromise: Promise<void> | undefined
_prefetchedRefresh: GetTimeline.Response | GetAuthorFeed.Response | undefined
// data
feed: FeedItemModel[] = []
@ -225,7 +224,6 @@ export class FeedModel {
_loadMorePromise: false,
_loadLatestPromise: false,
_updatePromise: false,
_prefetchedRefresh: false,
},
{autoBind: true},
)
@ -283,16 +281,8 @@ export class FeedModel {
* Reset and load
*/
async refresh() {
if (this._prefetchedRefresh) {
await this._pendingWork()
this._replaceAll(this._prefetchedRefresh)
this.setHasNewLatest(false)
this._xIdle()
} else {
await this.setup(true)
}
this._prefetchedRefresh = undefined
}
/**
* Load more posts to the end of the feed
@ -343,8 +333,7 @@ export class FeedModel {
}
await this._pendingWork()
const res = await this._getFeed({limit: 1})
const prefetchedLatestUri = this._prefetchedRefresh?.data.feed[0]?.uri
const currentLatestUri = prefetchedLatestUri || this.pollCursor
const currentLatestUri = this.pollCursor
const receivedLatestUri = res.data.feed[0]
? res.data.feed[0].uri
: undefined
@ -353,9 +342,6 @@ export class FeedModel {
(this.feed.length === 0 || receivedLatestUri !== currentLatestUri),
)
this.setHasNewLatest(hasNewLatest)
if (hasNewLatest && prefetchedLatestUri !== receivedLatestUri) {
this._prefetchedRefresh = await this._getFeed({limit: PAGE_SIZE})
}
}
// state transitions