ErikDakoda / vulcan-material-ui

Replacement for Vulcan components using Material-UI.
28 stars 13 forks source link

Is there a typo in FormGroup.jsx? #37

Closed eddielisands closed 5 years ago

eddielisands commented 5 years ago

'FormComponents.FormComponent' should be 'Components.FormComponent'?

Julien-Sytadelle commented 5 years ago

We can find <FormComponents.FormComponent ...> in FormGroup.jsx l160, FormGroupNone l56 and FormGroupWithLine l158. Each time its defined before: const FormComponents = this.props.formComponents; I am not strong enough to tell if it is a typo and should be or if it comes from other problem.

Also, About forms, using package cloned from repo, I have an error telling we can not replace FormNestedHead as it has not been imported. I did not have time to investigate.

eric-burel commented 5 years ago

Hi @eddielisands, the SmartForm and its component should now accept a FormComponents props for local override, eg if you want a specific input design for a given page. See this as a local replaceComponent.

So there is no typo, it's just that the formComponents should always be merged with the vulcan:core Components at the beginning of the render to guarantee that all components are defined.

vulcan-material-ui might not be totally up-to-date on this because those are very recent changes to Vulcan (we merged a form cleanup just this morning in the core). It will however simplify further development of Vulcan UI packages so this is rather good news.

I invite you to take a look at the vulcan:forms package, or even to submit a PR, those are good first issues once you get the Component replacement workflow. If you can't I'll try to fix them if I find some spare time.

eddielisands commented 5 years ago

@eric-burel Thanks for your information, but it breaks when I click new form and edit form in my app.

eddielisands commented 5 years ago

@Julien-Sytadelle That's what I did to fix the rendering issue at the moment.

Julien-Sytadelle commented 5 years ago

@eric-burel Thanks for your information, but it breaks when I click new form and edit form in my app.

I have the same problem and did not have time to investigate yet (was reading vulcan doc...)

Julien-Sytadelle commented 5 years ago

After update to latest version I have this error when opening an edit form: Cannot read property 'FormComponent' of undefined @FormGroup.jsx l160 so this.props.formComponents is undefined. FormGroup does not have default value for formComponents.

ErikDakoda commented 5 years ago

Which branch of the Vulcan codebase are you using with it? It should work with the most current devel branch.

Julien-Sytadelle commented 5 years ago

I use a vulcan-starter clone using 1.12.8, not updated, and I have seen I should pass the missing prop to smartform. I just still not figured what I must put in the prop as I thought smartform did everything from the schema. I started node, meteor and vulcan last week so still learning (was using django untill now).

eric-burel commented 5 years ago

@Julien-Sytadelle if you want to use vulcan:material-ui, I'd suggest you to go for a 2-repo install of Vulcan http://docs.vulcanjs.org/#Two-Repo-Install-Optional. This way you'll enjoy the very last improvements of Vulcan and vulcan:material-ui. Let us know on the Vulcan Slack if you encounter issues, it's very active and helpful for beginners.

You can indeed pass formComponents={Components} to the SmartForm, but it should not be necessary if you use the last version of Vulcan.

Julien-Sytadelle commented 5 years ago

I will do this and let you know if I am still lost. Thanks!

Edit: remove email trace and by the way everything works fine with 3 repo install