Properly reset 'Destination' field while changing transaction type.

This commit is contained in:
muzam1l
2022-08-03 16:44:27 +05:30
parent fb9814ec76
commit aae9c7468f
2 changed files with 4 additions and 3 deletions

View File

@@ -154,10 +154,12 @@ const Transaction: FC<TransactionProps> = ({
const nwState: Partial<TransactionState> = { const nwState: Partial<TransactionState> = {
viewType, viewType,
selectedTransaction: transactionType, selectedTransaction: transactionType,
selectedDestAccount: null
}; };
// Currently in schema "Destination": "SomeVal" means 'Destination is required' while empty string indicates it is optional
// TODO Update schema with clear required tag
if (fields.Destination !== undefined) { if (fields.Destination !== undefined) {
nwState.selectedDestAccount = null;
fields.Destination = ""; fields.Destination = "";
} else { } else {
fields.Destination = undefined; fields.Destination = undefined;

View File

@@ -58,12 +58,11 @@ export const TxUI: FC<UIProps> = ({
const fields = getTxFields(tt); const fields = getTxFields(tt);
if (fields.Destination !== undefined) { if (fields.Destination !== undefined) {
setState({ selectedDestAccount: null });
fields.Destination = ""; fields.Destination = "";
} else { } else {
fields.Destination = undefined; fields.Destination = undefined;
} }
return setState({ txFields: fields }); return setState({ txFields: fields, selectedDestAccount: null });
}, },
[setState] [setState]
); );