File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
wallets/client/components/form Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export function useProtocolForm (protocol) {
104104 const { lud16 } = parseNwcUrl ( nwcSendFormState . config . url )
105105 if ( lud16 ?. split ( '@' ) [ 1 ] === lud16Domain ) value = lud16
106106 }
107- // remove domain part since we will append it automatically if lud16Domain is set
107+ // remove domain part since we will append it automatically on submit if lud16Domain is set
108108 if ( lud16Domain && value ) {
109109 value = value . split ( '@' ) [ 0 ]
110110 }
@@ -120,6 +120,7 @@ export function useProtocolForm (protocol) {
120120 if ( lud16Domain ) {
121121 schema = schema . transform ( ( { address, ...rest } ) => {
122122 return {
123+ // append domain part to pass validation on submit
123124 address : address ? `${ address } @${ lud16Domain } ` : '' ,
124125 ...rest
125126 }
Original file line number Diff line number Diff line change @@ -100,6 +100,8 @@ function WalletProtocolForm () {
100100
101101 // create a copy of values to avoid mutating the original
102102 const onSubmit = useCallback ( async ( { ...values } ) => {
103+ // the schema transformation already does this to pass validation on submit
104+ // so it would be better to use the transformed values instead of manually appending the domain part again here
103105 const lud16Domain = walletLud16Domain ( wallet . name )
104106 if ( values . address && lud16Domain ) {
105107 values . address = `${ values . address } @${ lud16Domain } `
You can’t perform that action at this time.
0 commit comments