Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumField - AutoForm #516

Closed
khaledbk opened this issue Mar 5, 2019 · 5 comments
Closed

NumField - AutoForm #516

khaledbk opened this issue Mar 5, 2019 · 5 comments
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@khaledbk
Copy link

khaledbk commented Mar 5, 2019

import AutoForm from 'uniforms-material/AutoForm';

import NumField from 'uniforms-material/NumField';

Hi, Im trying to use the AutoForm . In this form i use the NumField . The problem that i have is that the NumField convert this field value to a string type, is there any solution to have a Int type instead of a string in the model of the Form ?

@simplecommerce
Copy link
Contributor

simplecommerce commented Mar 5, 2019

From our tests, this is what we have found out.

We are using the material-ui package for uniforms.
On AutoForm we have put his code:

onChange={(key, value) => {
  console.log(key, value);  
})

We can see the log of the key being changed, and its numeric.

And with modelTransform we did a console.log of the model received, and the number changes to a string.

The versions used are:

"uniforms": "^1.31.0",
"uniforms-material": "^1.31.0"

With

"@material-ui/core": "^3.9.2",

I have tried to figure out where the bug occurs, but can't seem to find where it actually changes in your code.

The screenshot below shows the console.log for the key being changed with its value and the other is the console.log of the model state in the transform model, you can see the same key is now a string.

image

@radekmie radekmie self-assigned this Mar 5, 2019
@radekmie radekmie added Type: Question Questions and other discussions Type: Bug Bug reports and their fixes and removed Type: Question Questions and other discussions labels Mar 5, 2019
@radekmie
Copy link
Contributor

radekmie commented Mar 5, 2019

Hi @khaledbk and @simplecommerce. As GraphQL schema (which I assume, based on your screenshot) is not related here, here's the issue: NumField#33. In all other themes, either the UI component takes care of it (AntD) or there's an additional wrapper (like in uniforms-unstyled). Would you like to submit a PR for it?

@simplecommerce
Copy link
Contributor

Hi @radekmie appreciate your response, although I am not quite I understand what the issue is?

We have been using this package and have implemented it for a while now and never had this problem until today with the NumField?

So I am wondering what changed exactly or how to fix it?

Thanks!

@radekmie
Copy link
Contributor

radekmie commented Mar 5, 2019

It looks like it was broken since #427, when the Num class got removed. Maybe it changed with the newer version of MUI? I'm not sure. Anyway, the thing that needs to be done is to bring back the Num class. If you are still not sure about it, I'll get to it tomorrow.

@simplecommerce
Copy link
Contributor

simplecommerce commented Mar 5, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

No branches or pull requests

3 participants