@@ -402,7 +402,7 @@ function Search({
402402 // eslint-disable-next-line react-hooks/exhaustive-deps
403403 } , [ isSmallScreenWidth ] ) ;
404404
405- const { newSearchResultKeys, handleSelectionListScroll, newTransactions} = useSearchHighlightAndScroll ( {
405+ const { newSearchResultKeys, handleSelectionListScroll, newTransactions, hasQueuedHighlights } = useSearchHighlightAndScroll ( {
406406 searchResults,
407407 transactions,
408408 previousTransactions,
@@ -415,15 +415,15 @@ function Search({
415415 shouldUseLiveData,
416416 } ) ;
417417
418- // Mirror `newSearchResultKeys ` into a ref so the post-create-flow `useFocusEffect`
418+ // Mirror `hasQueuedHighlights ` into a ref so the post-create-flow `useFocusEffect`
419419 // (which has empty deps) can read the latest value without re-creating its callback.
420420 // Used to skip the deferral that would otherwise hide the freshly-added row from
421421 // FlashList during the RHP dismiss transition, which would prevent the highlight
422422 // animation from ever firing on it.
423- const newSearchResultKeysRef = useRef ( newSearchResultKeys ) ;
423+ const hasQueuedHighlightsRef = useRef ( hasQueuedHighlights ) ;
424424 useEffect ( ( ) => {
425- newSearchResultKeysRef . current = newSearchResultKeys ;
426- } , [ newSearchResultKeys ] ) ;
425+ hasQueuedHighlightsRef . current = hasQueuedHighlights ;
426+ } , [ hasQueuedHighlights ] ) ;
427427
428428 // There's a race condition in Onyx which makes it return data from the previous Search, so in addition to checking that the data is loaded
429429 // we also need to check that the searchResults matches the type and status of the current search
@@ -484,7 +484,7 @@ function Search({
484484 // skip the skeleton-during-transition defer. Otherwise FlashList stays empty
485485 // for ~1s while the RHP dismiss transition runs, the row never mounts inside
486486 // the 300ms highlight window, and `useAnimatedHighlightStyle` never fires.
487- if ( newSearchResultKeysRef . current && newSearchResultKeysRef . current . size > 0 ) {
487+ if ( hasQueuedHighlightsRef . current ) {
488488 return ;
489489 }
490490
0 commit comments