question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field lookup does not work in nested schemas

See original GitHub issue

First 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:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
marina-mosticommented, Sep 14, 2021

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?

1reaction
marina-mosticommented, Sep 3, 2021

Hey @datenspast thanks I’m on vacation I’ll check it out when I get back 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lookup() Not Working Correctly with Nested JSON
Solved: Ok, I might be going insane here, but this Lookup() function is not functioning correctly. Its so complicated though, I don't know ......
Read more >
$lookup with foreign field of array & nested foreign field
I want to fetch order details orders collection & product details using product_id from product collection that is foreign key.
Read more >
$lookup aggregation on nested array - MongoDB
I'd like to make $lookup aggregation to get the entire user schema into follower object in “stats.followers”.
Read more >
Nested lookup fields not returning a value using ...
The issue is that obj is never NOT null, despite the fact that I'm sure there is data in the results. Is this...
Read more >
How to create a Schema containing a dict of nested ... - GitHub
Hi. I've been digging around and couldn't find the answer to this. Say I've got a model like this: class AlbumSchema(Schema): year =...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found