Binder looses binderNode.defaultValue for nested keys inside repeat() in Hilla 2.2.0

Hello! How to fix the exception? The passed model has ‘address’ key, but binder can’t get defaultValue.

This rendering array model:

${this.binder.model.projectDocumentsDeveloper ? repeat( this.binder.model.projectDocumentsDeveloper, (declarant) => { return html
<vaadin-text-field
…=${field(
declarant.model.organization.address.country
)}
>
; } ) : ""}

The error appearce when I try to add an element into array:
<vaadin-button @click=${() => { if (!this.binder.value.projectDocumentsDeveloper) { const declarant = TDeclarantModel.createEmptyValue(); declarant.organization = TOrganizationModel.createEmptyValue(); declarant.organization.address = TAddressModel.createEmptyValue(); this.binder.value.projectDocumentsDeveloper = [declarant]; } else { this.binder .for(this.binder.model.projectDocumentsDeveloper) .appendItem(); } this.requestUpdate(); }} > Add </vaadin-button>

This is Java model:
protected List<TDeclarant> projectDocumentsDeveloper;

this is console.error:
Encountered an uncaught exception that was thrown by a reaction or observer component, in: ‘Reaction[ConclusionView.update()]’ TypeError: Cannot read properties of undefined (reading ‘address’)
at get defaultValue [as defaultValue] (BinderNode.ts:153:26)
at g2.initializeValue (BinderNode.ts:422:73)
at new g2 (BinderNode.ts:94:10)
at b2 (Models.ts:23:26)

After some research, I noticed that binder looses default values for nested keys in array model.
This is binder.defaultValue after initialization:
[ { "organization": { "address": { "building": "", "city": "", "country": "", "district": "", "note": "", "region": "", "room": "", "settlement": "", "street": "" } } } ]

And this is binderNode.defaultValue inside repeat() function:
{ organization: undefined }

But binderNode.value is correct:
{ "organization": { "address": { "building": "", "city": "", "country": "", "district": "", "note": "", "region": "", "room": "", "settlement": "", "street": "" } } }

Binder looses nested key values in ArrayModel inside repeat() in Hilla 2.2.0

Binder looses nested key default values in ArrayModel inside repeat() in Hilla 2.2.0

Binder looses binderNode.defaultValue for nested keys inside repeat() in Hilla 2.2.0

Any ideas?

Sounds like it could be a bug. Can you please create a GitHub issue at Issues · vaadin/hilla · GitHub ?

It is already done. https://github.com/vaadin/hilla/issues/1294

Okay, looks like it’s already being looked into.

Is there workaround how to bind array data to form? my project is stuck until the bug will be fixed

The GitHub issue has some suggestions.

thanks a lot!