Field lookup does not work in nested schemas
See original GitHub issueFirst of all: Thanks for the great library! Not sure if this is a bug that relates to the formvuelate library or the lookup plugin. Maybe the bug relates to different problems. I name them [A] and [B].
Describe the bug It seems that the field lookup does not work in nested schemas.
To Reproduce [A] I modified the codepen example here: https://codesandbox.io/s/fvl-nested-schema-3-x-forked-tq9zl?file=/src/App.vue You can uncomment/comment the lines 40 and 41 to reproduce it.
Expected behavior I would expect that the following would work as well, but the field in the nested schema is not rendered. I`m also refering to the example in the guide for nested schemas: https://formvuelate.js.org/guide/lookup.html#nested-schema-caveats
const SchemaFormWithPlugins = SchemaFormFactory([
LookupPlugin({
mapComponents: {
Text: FormText,
}
})
])
const SCHEMA = [
{
model: "firstName",
component: "Text",
label: "First Name",
},
{
model: "nested",
component: SchemaForm,
schema: [
{
model: "nestedfirstName",
component: FormText, // this works
// component: "Text", // this does not work
label: "First Name nested",
},
],
},
]
[B]
Please note that the solution to mapComponent
in the SchemaFormFactory
described here https://formvuelate.js.org/guide/lookup.html#nested-schema-caveats did not work in my case.
If this is applied, it seems that the nested schema is not rendered at all: https://codesandbox.io/s/fvl-nested-schema-3-x-forked-s3s50?file=/src/App.vue
const SchemaFormWithPlugins = SchemaFormFactory([
LookupPlugin({
mapComponents: {
SchemaForm: "SchemaFormWithPlugins",
Text: FormText,
},
}),
]);
const SCHEMA = [
{
model: "firstName",
component: "Text",
label: "First Name",
},
{
model: "nested",
component: SchemaForm, // this works
// component: "SchemaForm", // this does not work
schema: [
{
model: "nestedfirstName",
component: FormText,
label: "First Name nested",
},
],
},
];
System Info
- Formvuelate version: 3.1.0
- plugins being used with versions:
"@formvuelate/plugin-lookup": "^2.1.0",
"@formvuelate/plugin-vee-validate": "^2.2.1",
Thanks for any help!
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
Thanks for the repro @datenspast
@logaretm i have a feeling somewhere around ln 58-64 were conflicting in the parsing bc on ParsedSchema ln 104 I need a way to identify the name. I guess maybe we could try changing that condition to check for a
.schema
also. Wdyt?Hey @datenspast thanks I’m on vacation I’ll check it out when I get back 👍