Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix merchant error is shown in split bill details page while scanning #37393

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ function MoneyRequestConfirmationList(props) {
}, [props.isEditingSplitBill, props.hasSmartScanFailed, transaction, didConfirmSplit]);

const isMerchantEmpty = !props.iouMerchant || props.iouMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;
const shouldDisplayMerchantError = props.isPolicyExpenseChat && !props.isScanRequest && isMerchantEmpty;
const shouldDisplayMerchantError = props.isPolicyExpenseChat && shouldDisplayFieldError && isMerchantEmpty;

useEffect(() => {
if (shouldDisplayFieldError && didConfirmSplit) {
Expand Down Expand Up @@ -750,14 +750,8 @@ function MoneyRequestConfirmationList(props) {
}}
disabled={didConfirm}
interactive={!props.isReadOnly}
brickRoadIndicator={
props.isPolicyExpenseChat && shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''
}
error={
shouldDisplayMerchantError || (props.isPolicyExpenseChat && shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction))
? translate('common.error.enterMerchant')
: ''
}
brickRoadIndicator={shouldDisplayMerchantError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
error={shouldDisplayMerchantError ? translate('common.error.enterMerchant') : ''}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition is simplified here. We don't need to check TransactionUtils.isMerchantMissing anymore because shouldDisplayMerchantError already contains isMerchantEmpty.

props.iouMerchant contains either modifiedMerchant or merchant.

Also, the condition here is last updated in this PR, I was trying to make sure the test step there still passed, but we have this issue

/>
)}
{shouldShowCategories && (
Expand Down
Loading