File tree 1 file changed +14
-2
lines changed
src/pages/iou/request/step 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -201,17 +201,29 @@ function IOURequestStepConfirmation({
201
201
} , [ transactionID , defaultBillable ] ) ;
202
202
203
203
useEffect ( ( ) => {
204
- if ( ! ! isLoadingTransaction || ( transaction ?. transactionID && ( ! transaction ?. isFromGlobalCreate || ! isEmptyObject ( transaction ?. participants ) ) ) ) {
204
+ // Exit early if the transaction is still loading
205
+ if ( isLoadingTransaction ) {
205
206
return ;
206
207
}
208
+
209
+ // Check if the transaction belongs to the current report
210
+ const isCurrentReportID = transaction ?. isFromGlobalCreate
211
+ ? transaction ?. participants ?. at ( 0 ) ?. reportID === reportID || ( ! transaction ?. participants ?. at ( 0 ) ?. reportID && transaction ?. reportID === reportID )
212
+ : transaction ?. reportID === reportID ;
213
+
214
+ // Exit if the transaction already exists and is associated with the current report
215
+ if ( transaction ?. transactionID && ( ! transaction ?. isFromGlobalCreate || ! isEmptyObject ( transaction ?. participants ) ) && isCurrentReportID ) {
216
+ return ;
217
+ }
218
+
207
219
startMoneyRequest (
208
220
CONST . IOU . TYPE . CREATE ,
209
221
// When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used
210
222
// for all of the routes in the creation flow.
211
223
generateReportID ( ) ,
212
224
) ;
213
225
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we don't want this effect to run again
214
- } , [ isLoadingTransaction ] ) ;
226
+ } , [ isLoadingTransaction , reportID ] ) ;
215
227
216
228
useEffect ( ( ) => {
217
229
if ( ! transaction ?. category ) {
You can’t perform that action at this time.
0 commit comments