Skip to content

Commit e70a702

Browse files
committed
💚 AddressNL unreliable validation
Make sure that `get emptyValue()` stays a regular function. Making the `get emptyValue()` static results into weird validation issues, broken e2e tests, and general unpleassant behavior.
1 parent 263df05 commit e70a702

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/formio/components/AddressNL.jsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ export default class AddressNL extends Field {
3535
label: 'Address NL',
3636
input: true,
3737
key: 'addressNL',
38-
defaultValue: this.emptyValue,
38+
defaultValue: {
39+
postcode: '',
40+
houseNumber: '',
41+
houseLetter: '',
42+
houseNumberAddition: '',
43+
city: '',
44+
streetName: '',
45+
secretStreetCity: '',
46+
},
3947
validateOn: 'blur',
4048
deriveAddress: false,
4149
layout: 'doubleColumn',
@@ -68,7 +76,7 @@ export default class AddressNL extends Field {
6876
return AddressNL.schema();
6977
}
7078

71-
static get emptyValue() {
79+
get emptyValue() {
7280
return {
7381
postcode: '',
7482
houseNumber: '',
@@ -152,7 +160,7 @@ export default class AddressNL extends Field {
152160
return;
153161
}
154162
const required = this.component?.validate?.required || false;
155-
const initialValues = {...AddressNL.emptyValue, ...this.dataValue};
163+
const initialValues = {...this.emptyValue, ...this.dataValue};
156164

157165
this.reactRoot.render(
158166
<IntlProvider {...this.options.intl}>

0 commit comments

Comments
 (0)