Fix crash when clicking "find people to follow"

This commit is contained in:
Alex Benzer
2025-11-30 15:48:35 -08:00
parent de1368559c
commit fcdc1dd486
+9 -11
View File
@@ -3,7 +3,6 @@ import {
TextInput,
useWindowDimensions,
View,
type ViewabilityConfig,
type ViewToken,
} from 'react-native'
import {type ModerationOpts} from '@atproto/api'
@@ -235,14 +234,17 @@ function DialogInner({guide}: {guide: Follow10ProgressGuide}) {
// Track seen profiles
const seenProfilesRef = useRef<Set<string>>(new Set())
const onViewableItemsChanged = useCallback(
const itemsRef = useRef(items)
itemsRef.current = items
const onViewableItemsChanged = useRef(
({viewableItems}: {viewableItems: ViewToken[]}) => {
for (const viewableItem of viewableItems) {
const item = viewableItem.item as Item
if (item.type === 'profile') {
if (!seenProfilesRef.current.has(item.profile.did)) {
seenProfilesRef.current.add(item.profile.did)
const position = items.findIndex(
const position = itemsRef.current.findIndex(
i => i.type === 'profile' && i.profile.did === item.profile.did,
)
logger.metric(
@@ -258,14 +260,10 @@ function DialogInner({guide}: {guide: Follow10ProgressGuide}) {
}
}
},
[items],
)
const viewabilityConfig: ViewabilityConfig = useMemo(
() => ({
itemVisiblePercentThreshold: 50,
}),
[],
)
).current
const viewabilityConfig = useRef({
itemVisiblePercentThreshold: 50,
}).current
const onSelectTab = useCallback(
(interest: string) => {