[Explore] Add shadow cache (#8119)

* enable shadowcache for feed previews

* extract keyextractor

* dedupe feeds
This commit is contained in:
Samuel Newman
2025-04-04 17:15:40 +03:00
committed by GitHub
parent a15658cb66
commit a0c644acfe
5 changed files with 194 additions and 41 deletions
+9 -5
View File
@@ -15,6 +15,10 @@ import {logger} from '#/logger'
import {type MetricEvents} from '#/logger/metrics'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {useActorSearchPaginated} from '#/state/queries/actor-search'
import {
type FeedPreviewItem,
useFeedPreviews,
} from '#/state/queries/explore-feed-previews'
import {useGetPopularFeedsQuery} from '#/state/queries/feed'
import {usePreferencesQuery} from '#/state/queries/preferences'
import {useSuggestedFollowsQuery} from '#/state/queries/suggested-follows'
@@ -47,10 +51,6 @@ import {Loader} from '#/components/Loader'
import * as ProfileCard from '#/components/ProfileCard'
import {Text} from '#/components/Typography'
import * as ModuleHeader from './components/ModuleHeader'
import {
type FeedPreviewItem,
useFeedPreviews,
} from './modules/ExploreFeedPreviews'
import {
SuggestedAccountsTabBar,
SuggestedProfileCard,
@@ -900,7 +900,7 @@ export function Explore({
<List
data={items}
renderItem={renderItem}
keyExtractor={item => item.key}
keyExtractor={keyExtractor}
desktopFixedHeight
contentContainerStyle={{paddingBottom: 100}}
keyboardShouldPersistTaps="handled"
@@ -914,6 +914,10 @@ export function Explore({
)
}
function keyExtractor(item: FeedPreviewItem) {
return item.key
}
const viewabilityConfig: ViewabilityConfig = {
itemVisiblePercentThreshold: 100,
}