11import { useIsFocused , useRoute } from '@react-navigation/native' ;
2+ import { stableReportSelector } from '@selectors/Report' ;
23import type { ListRenderItemInfo } from '@shopify/flash-list' ;
34import React , { memo , useCallback , useContext , useEffect , useLayoutEffect , useMemo , useRef , useState } from 'react' ;
45import type { LayoutChangeEvent , NativeScrollEvent , NativeSyntheticEvent } from 'react-native' ;
@@ -20,7 +21,6 @@ import useReportIsArchived from '@hooks/useReportIsArchived';
2021import useReportScrollManager from '@hooks/useReportScrollManager' ;
2122import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
2223import useScrollToEndOnNewMessageReceived from '@hooks/useScrollToEndOnNewMessageReceived' ;
23- import useStableReportForReportActionItem from '@hooks/useStableReportForReportActionItem' ;
2424import useStyleUtils from '@hooks/useStyleUtils' ;
2525import useThemeStyles from '@hooks/useThemeStyles' ;
2626import useWindowDimensions from '@hooks/useWindowDimensions' ;
@@ -220,7 +220,7 @@ function ReportActionsList({
220220 const [ reportNameValuePairs ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_NAME_VALUE_PAIRS } ${ report . reportID } ` ) ;
221221 const isHarvestCreatedExpenseReportAction = isHarvestCreatedExpenseReport ( reportNameValuePairs ?. origin , reportNameValuePairs ?. originalID ) ;
222222
223- const reportStable = useStableReportForReportActionItem ( report ) ?? report ;
223+ const [ reportStable = report ] = useOnyx ( ` ${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` , { selector : stableReportSelector } ) ;
224224
225225 const backTo = route ?. params ?. backTo as string ;
226226 const linkedReportActionID = route ?. params ?. reportActionID ;
@@ -348,6 +348,7 @@ function ReportActionsList({
348348 visibleReportActionsWithDraft . push ( draftReportAction ) ;
349349 return visibleReportActionsWithDraft ;
350350 } , [ draftReportAction , sortedVisibleReportActions ] ) ;
351+
351352 const draftMessageHTML = draftReportAction ? getReportActionMessage ( draftReportAction ) ?. html : undefined ;
352353 const isSyntheticDraftVisible = ! ! draftReportAction && renderedVisibleReportActions !== sortedVisibleReportActions ;
353354 const draftAutoScrollKey = isSyntheticDraftVisible ? `${ draftReportAction . reportActionID } :${ draftMessageHTML ?? '' } ` : '' ;
0 commit comments