@@ -86,6 +86,9 @@ type MoneyRequestReceiptViewProps = {
8686
8787 /** Whether it's displayed in Wide RHP */
8888 isDisplayedInWideRHP ?: boolean ;
89+
90+ /** Whether the parent component has a pending action */
91+ hasParentPendingAction ?: boolean ;
8992} ;
9093
9194const receiptImageViolationNames = new Set < OnyxTypes . ViolationName > ( [
@@ -100,7 +103,15 @@ const receiptImageViolationNames = new Set<OnyxTypes.ViolationName>([
100103
101104const receiptFieldViolationNames = new Set < OnyxTypes . ViolationName > ( [ CONST . VIOLATIONS . MODIFIED_AMOUNT , CONST . VIOLATIONS . MODIFIED_DATE ] ) ;
102105
103- function MoneyRequestReceiptView ( { report, readonly = false , updatedTransaction, fillSpace = false , mergeTransactionID, isDisplayedInWideRHP = false } : MoneyRequestReceiptViewProps ) {
106+ function MoneyRequestReceiptView ( {
107+ report,
108+ readonly = false ,
109+ updatedTransaction,
110+ fillSpace = false ,
111+ mergeTransactionID,
112+ isDisplayedInWideRHP = false ,
113+ hasParentPendingAction = false ,
114+ } : MoneyRequestReceiptViewProps ) {
104115 const styles = useThemeStyles ( ) ;
105116 const { translate} = useLocalize ( ) ;
106117 const { environmentURL} = useEnvironment ( ) ;
@@ -177,7 +188,16 @@ function MoneyRequestReceiptView({report, readonly = false, updatedTransaction,
177188 }
178189 const pendingAction = transaction ?. pendingAction ;
179190 // Need to return undefined when we have pendingAction to avoid the duplicate pending action
180- const getPendingFieldAction = ( fieldPath : TransactionPendingFieldsKey ) => ( pendingAction ? undefined : transaction ?. pendingFields ?. [ fieldPath ] ) ;
191+ const getPendingFieldAction = ( fieldPath : TransactionPendingFieldsKey ) => {
192+ if ( hasParentPendingAction ) {
193+ return undefined ;
194+ }
195+ if ( isDisplayedInWideRHP ) {
196+ return transaction ?. pendingFields ?. [ fieldPath ] ?? pendingAction ;
197+ }
198+
199+ return pendingAction ? undefined : transaction ?. pendingFields ?. [ fieldPath ] ;
200+ } ;
181201
182202 const transactionToCheck = updatedTransaction ?? transaction ;
183203 const doesTransactionHaveReceipt = ! ! transactionToCheck ?. receipt && ! isEmptyObject ( transactionToCheck ?. receipt ) ;
0 commit comments