Repository navigation
fix(renderer): tolerate unknown userData keys and formData without config - #507
Conversation
formBuilder2Formeo writes columns with no config, and hand-written formData often leaves it out, so the renderer threw reading width, legend or inline. Default config (and children) where the renderer reads them, and test with data shaped like the converter's output. Refs #212
…option-wrap className The userData setter blamed every key as unmatched when no form was rendered yet; warn once that it was set before render() instead, and return before touching a nonexistent form. Also strengthen two renderer.test.js assertions left too loose by earlier fixes: the option-group-with-no-config test now sets a field className and checks it lands on the group's wrap, and the formBuilder2Formeo column-style loop now asserts it actually iterates 3 columns. Refs #123 Refs #212
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved renderer setter issues remain for collection-property keys and file-input values.
Review effort: Lite
Findings: 1
What changed in this PR
Improves renderer handling of unknown userData keys, multiple-select values, and legacy form data without configuration.
Changes:
- Adds safer user-data restoration and warnings.
- Handles missing configuration and children.
- Adds tests, fixtures, and documentation.
| File | Description |
|---|---|
tests/renderer-user-data.spec.js |
Adds browser-level setter coverage. |
src/lib/js/renderer/renderer.test.js |
Adds renderer regression tests. |
src/lib/js/renderer/index.js |
Updates user-data handling and config processing. |
src/lib/js/renderer/__fixtures__/formbuilder2formeo.mjs |
Adds converter-shaped form data. |
src/lib/js/common/dom.js |
Safely handles missing field configuration. |
docs/renderer/renderer.md |
Documents setter behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| const unmatched = [] | ||
| for (const key of keys) { | ||
| const fields = form?.elements[key] ?? form?.elements[`${key}[]`] |
|
@copilot Fix the code for all comments in this review thread. When a review comment includes a suggested change, apply the suggestion exactly. Do not make changes beyond what is described in the linked review thread. |
Co-authored-by: kevinchappell <1457540+kevinchappell@users.noreply.github.com>
Addressed in e011a36. |
|
🎉 This PR is included in version 5.9.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |

What
Two renderer robustness fixes.
renderer.userDatasetterTypeErrorand drop every key after it. Such keys are now skipped, with one console warning listing them:formeo: renderer.userData has no field named: ….nullis a no-op, and setting data beforerender()warns that there's nothing to fill yet.<select multiple>now takes an array of values. Before, it got the string"x,z".formData without
configconfig(what formBuilder2Formeo writes for columns) and radio or checkbox groups withoutconfigused to throw, readingwidth,legendorinline. They now render.childrenarray is treated as empty.convertData()output.attrs.type, so hidden and option-group fields don't render as such. That's covered separately in the migration docs.Refs #123
Refs #229
Refs #212
Testing
npm test: 581 passnpm run lint: cleantests/renderer-user-data.spec.js.