Unblock React Compiler for 6 components by removing render-phase ref access

- useAnimatedValue: lazy-init ref -> lazy useState initialiser
- QueryProviderInner: ref-based invariant -> useState, which render may read
- useSaveMessageDraft: mirror ref -> useEffectEvent for the message only, so
  the cleanup keeps the convo id its own effect captured
- FollowDialog: two mirror refs deleted outright, since the surrounding
  useNonReactiveCallback already captures the latest values
- OTPInput, WhoCanReply: ios()/Platform.select() wrapping a ref-reading
  callback -> a plain conditional, which the compiler can see through

Skipped components: 125 -> 119. Net 14 fewer lines.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tomek Zawadzki
2026-08-25 16:20:52 +02:00
parent f87fdd2ea2
commit 69f9c7fc8f
6 changed files with 27 additions and 41 deletions
@@ -270,10 +270,6 @@ function DialogInner({guide}: {guide?: Follow10ProgressGuide}) {
// Track seen profiles
const seenProfilesRef = useRef<Set<string>>(new Set())
const itemsRef = useRef(items)
itemsRef.current = items
const selectedInterestRef = useRef(selectedInterest)
selectedInterestRef.current = selectedInterest
const onViewableItemsChanged = useNonReactiveCallback(
({viewableItems}: {viewableItems: ViewToken[]}) => {
@@ -282,7 +278,7 @@ function DialogInner({guide}: {guide?: Follow10ProgressGuide}) {
if (item.type === 'profile') {
if (!seenProfilesRef.current.has(item.profile.did)) {
seenProfilesRef.current.add(item.profile.did)
const position = itemsRef.current.findIndex(
const position = items.findIndex(
i => i.type === 'profile' && i.profile.did === item.profile.did,
)
ax.metric('suggestedUser:seen', {
@@ -292,9 +288,7 @@ function DialogInner({guide}: {guide?: Follow10ProgressGuide}) {
position: position !== -1 ? position : 0,
suggestedDid: item.profile.did,
category:
selectedInterestRef.current === FOR_YOU_TAB
? null
: selectedInterestRef.current,
selectedInterest === FOR_YOU_TAB ? null : selectedInterest,
})
}
}