Giter Club home page Giter Club logo

Comments (2)

ErikDakoda avatar ErikDakoda commented on May 23, 2024

Hi @EloyID! I dug into this and could confirm this bug. I created a PR to fix it - along with a couple of small Form-related issues.

At first I fixed the issue by switching the order of {...props} and {...field} in FormNestedItem:

          <FormComponents.FormComponent
            key={i}
            {...field}
            {...props}
            path={`${path}.${field.name}`}
            itemIndex={itemIndex}
          />

But I was worried that this may have unintended side effects. Then I decided to just override the document props:

          <FormComponents.FormComponent
            key={i}
            {...props}
            {...field}
            document={props.document}
            path={`${path}.${field.name}`}
            itemIndex={itemIndex}
          />

That works, but I was worried that it does not address the source of the problem, which is, as you already guessed, in Form.jsx. So the PR fixes the problem in SmartForm.initField(), but I want somebody who is more familiar with this code to have a look before I merge the PR.

from vulcan.

EloyID avatar EloyID commented on May 23, 2024

Hi I have tried to go deeper in the code to be sure but it will be better if somebody more familiar checks it. I have had a look in the PRs and even if it fixes it for now, I can't understand why it works for normal fields but not for the nested ones. Both fields pass through Form.jsx > createField. So maybe we are having two source of truth what can be a cause of other problems later.

Following the same reasoning, MuiInput worked in the nested schema but no the MuiSelect, because the first one is not really controlled (it updates its value before the parent tells) while MuiSelect didn't. For me the MuiSelect is a better approach because in the future we can have bugs because we think the value is updating correctly in the back when it's only doing in the front.

from vulcan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.