Open cromoteca opened 3 weeks ago
One suggestion: let's use destructuring for the callback argument to get the item model right away, like so: {Arrays.from(model.people, ({model: personModel}) => <TextField {...field(personModel.name)} />)}
The above provided solution does not seem to work in every case. I still get a React error:
TypeError: Value is undefined
at ArrayModel.valueOf (http://localhost:8080/VAADIN/@fs/C:/workspace/hilla/node_modules/.vite/deps/chunk-PRZ344WL.js?v=9c5a6b2a:905:13)
at [Symbol.iterator] (http://localhost:8080/VAADIN/@fs/C:/workspace/hilla/node_modules/.vite/deps/chunk-PRZ344WL.js?v=9c5a6b2a:1006:24)
at ArrayModel.next (<anonymous>)
at Function.from (<anonymous>)
at MyHillariousForm (http://localhost:8080/VAADIN/elements/MyHillariousForm.tsx?t=1718181678530:55:13)
...
The syntax recommended to bind arrays in forms, introduced in https://github.com/vaadin/docs/pull/2733, looks incorrect: the
map
function doesn't exist.In
24.4
you can use{Arrays.from(model.people, (person) => <... />)}
. In24.5
, a new hook will be available: https://github.com/vaadin/hilla/pull/2505.If you think this issue is important, add a 👍 reaction to help the community and maintainers prioritize this issue.