Skip to content

Commit 3b905bb

Browse files
MelvinBotsituchan
andcommitted
Allow clearing optional merchant field in merchant rules
The isInvalidMerchantValue check in TextBase.validate was rejecting empty strings for the merchant rename field, even though the field is optional. This prevented users from clearing a previously-saved merchant value. Adding a truthiness guard so the validation only runs on non-empty values. Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
1 parent 2cf34d2 commit 3b905bb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/components/Rule/TextBase.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function TextBase<TFormID extends OnyxFormKey>({
6363
if (!isValid) {
6464
(errors as Record<string, string>)[fieldID] = translate('common.error.characterLimitExceedCounter', byteLength, characterLimit);
6565
} else if (fieldID === CONST.EXPENSE_RULES.FIELDS.RENAME_MERCHANT || fieldID === CONST.MERCHANT_RULES.FIELDS.MERCHANT) {
66-
if (isInvalidMerchantValue(trimmedValue)) {
66+
if (trimmedValue && isInvalidMerchantValue(trimmedValue)) {
6767
(errors as Record<string, string>)[fieldID] = translate('iou.error.invalidMerchant');
6868
}
6969
}

0 commit comments

Comments
 (0)