Fix lag when switching tabs (#2046)
parent
fcd22d4ccb
commit
cb193a827d
|
@ -1,3 +1,4 @@
|
||||||
|
import {useCallback} from 'react'
|
||||||
import {AppBskyFeedDefs, AppBskyFeedPost, moderatePost} from '@atproto/api'
|
import {AppBskyFeedDefs, AppBskyFeedPost, moderatePost} from '@atproto/api'
|
||||||
import {
|
import {
|
||||||
useInfiniteQuery,
|
useInfiniteQuery,
|
||||||
|
@ -130,7 +131,8 @@ export function usePostFeedQuery(
|
||||||
api: lastPage.api,
|
api: lastPage.api,
|
||||||
cursor: lastPage.cursor,
|
cursor: lastPage.cursor,
|
||||||
}),
|
}),
|
||||||
select(data) {
|
select: useCallback(
|
||||||
|
(data: InfiniteData<FeedPageUnselected, RQPageParam>) => {
|
||||||
const tuner = params?.disableTuner
|
const tuner = params?.disableTuner
|
||||||
? new NoopFeedTuner()
|
? new NoopFeedTuner()
|
||||||
: new FeedTuner(feedTuners)
|
: new FeedTuner(feedTuners)
|
||||||
|
@ -146,7 +148,8 @@ export function usePostFeedQuery(
|
||||||
isThread:
|
isThread:
|
||||||
slice.items.length > 1 &&
|
slice.items.length > 1 &&
|
||||||
slice.items.every(
|
slice.items.every(
|
||||||
item => item.post.author.did === slice.items[0].post.author.did,
|
item =>
|
||||||
|
item.post.author.did === slice.items[0].post.author.did,
|
||||||
),
|
),
|
||||||
items: slice.items
|
items: slice.items
|
||||||
.map((item, i) => {
|
.map((item, i) => {
|
||||||
|
@ -170,6 +173,8 @@ export function usePostFeedQuery(
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
[feedTuners, params?.disableTuner],
|
||||||
|
),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue