|
1 | | -import {useCallback} from 'react'; |
2 | 1 | import type {OnyxEntry} from 'react-native-onyx'; |
3 | 2 | import {getAllNonDeletedTransactions} from '@libs/MoneyRequestReportUtils'; |
4 | 3 | import {getOneTransactionThreadReportID, getSortedReportActionsForDisplay} from '@libs/ReportActionsUtils'; |
@@ -49,17 +48,12 @@ function useTransactionThread({reportID, report, allReportActions, isOffline}: U |
49 | 48 | const isReportArchived = useReportIsArchived(reportID); |
50 | 49 | const canPerformWriteAction = canUserPerformWriteAction(report, isReportArchived); |
51 | 50 |
|
52 | | - const getTransactionThreadReportActions = useCallback( |
53 | | - (reportActions: OnyxEntry<ReportActions>): ReportAction[] => selectTransactionThreadReportActions(!!canPerformWriteAction, transactionThreadReportID, reportActions), |
54 | | - [canPerformWriteAction, transactionThreadReportID], |
55 | | - ); |
56 | | - |
57 | 51 | const [transactionThreadReportActions] = useOnyx( |
58 | 52 | `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, |
59 | 53 | { |
60 | | - selector: getTransactionThreadReportActions, |
| 54 | + selector: (reportActions) => selectTransactionThreadReportActions(!!canPerformWriteAction, transactionThreadReportID, reportActions), |
61 | 55 | }, |
62 | | - [getTransactionThreadReportActions], |
| 56 | + [canPerformWriteAction, transactionThreadReportID], |
63 | 57 | ); |
64 | 58 |
|
65 | 59 | const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`); |
|
0 commit comments