@@ -15,17 +15,16 @@ import {
1515 canEditFieldOfMoneyRequest ,
1616 canHoldUnholdReportAction ,
1717 canUserPerformWriteAction as canUserPerformWriteActionReportUtils ,
18- isArchivedReport ,
1918 isInvoiceReport ,
2019 isMoneyRequestReport as isMoneyRequestReportUtils ,
2120 isTrackExpenseReport ,
2221} from '@libs/ReportUtils' ;
23- import type { ArchivedReportsIDSet } from '@libs/SearchUIUtils' ;
2422import type { IOUType } from '@src/CONST' ;
2523import CONST from '@src/CONST' ;
2624import ONYXKEYS from '@src/ONYXKEYS' ;
2725import ROUTES from '@src/ROUTES' ;
2826import type { Policy , Report , ReportAction , Session , Transaction } from '@src/types/onyx' ;
27+ import useArchivedReportsIdSet from './useArchivedReportsIdSet' ;
2928import useDuplicateTransactionsAndViolations from './useDuplicateTransactionsAndViolations' ;
3029import useLocalize from './useLocalize' ;
3130import useNetworkWithOfflineStatus from './useNetworkWithOfflineStatus' ;
@@ -86,22 +85,7 @@ function useSelectedTransactionsActions({
8685 const isTrackExpenseThread = isTrackExpenseReport ( report ) ;
8786 const isInvoice = isInvoiceReport ( report ) ;
8887
89- const [ archivedReportsIdSet = new Set < string > ( ) ] = useOnyx ( ONYXKEYS . COLLECTION . REPORT_NAME_VALUE_PAIRS , {
90- canBeMissing : true ,
91- selector : ( all ) : ArchivedReportsIDSet => {
92- const ids = new Set < string > ( ) ;
93- if ( ! all ) {
94- return ids ;
95- }
96-
97- for ( const [ key , value ] of Object . entries ( all ) ) {
98- if ( isArchivedReport ( value ) ) {
99- ids . add ( key ) ;
100- }
101- }
102- return ids ;
103- } ,
104- } ) ;
88+ const archivedReportsIdSet = useArchivedReportsIdSet ( ) ;
10589
10690 let iouType : IOUType = CONST . IOU . TYPE . SUBMIT ;
10791
@@ -141,10 +125,10 @@ function useSelectedTransactionsActions({
141125 duplicateTransactionViolations ,
142126 iouReport ,
143127 chatReport ,
128+ isChatIOUReportArchived ,
144129 false ,
145130 deletedTransactionIDs ,
146131 selectedTransactionIDs ,
147- isChatIOUReportArchived ,
148132 ) ;
149133 deletedTransactionIDs . push ( transactionID ) ;
150134 if ( action . childReportID ) {
0 commit comments