vazco / uniforms

A React library for building forms from any schema.
https://uniforms.tools
MIT License
1.97k stars 243 forks source link

[MUI5] Extra props passed to DOM #1119

Open wight554 opened 2 years ago

wight554 commented 2 years ago

Version:

{
    "uniforms": "^3.10.0-rc.0",
    "uniforms-bridge-json-schema": "^3.10.0-rc.0",
    "uniforms-mui": "^3.10.0-rc.0",
}

Errors I've managed to catch (more to be added):

SelectField:

Warning: React does not recognize the `InputLabelProps` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `inputlabelprops` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
<ScenarioSelectField
  allowedValues={['A', 'B', 'C']}
  name="field"
  size="small"
  InputLabelProps={{ shrink: true }}
/>
wight554 commented 2 years ago

Unsure about this one. Trying to replicate it in smaller form. It only happens on submit when num field is in form:

Warning: Received `true` for a non-boolean attribute `decimal`.

If you want to write it to the DOM, pass a string instead: decimal="true" or decimal={value.toString()}.

Edit: it's somehow related to ErrorField, reproduction snippet:

const schema = {
  title: 'Test',
  type: 'object',
  properties: {
    num: { title: 'Num', type: 'number', minimum: 0, maximum: 100 },
  },
  required: ['num'],
};

const schemaValidator = createValidator(schema);

export const bridge = new JSONSchemaBridge(schema, schemaValidator);

<AutoForm schema={bridge}>
  <AutoField name="num" />
  <ErrorField name="num" />
  <SubmitField />
</AutoForm>

Edit2: I assume it's due to

// uniforms-mui/src/ErrorField.tsx

<FormHelperText {...filterDOMProps(props)}>
  {children || errorMessage}
</FormHelperText>
wight554 commented 2 years ago

@radekmie at this point that's all I've faced. Might help debugging other possible props

wadamek65 commented 2 years ago

@wight554 Thanks for the issue report. Did you by any chance check if the same behavior exists for the uniforms-material theme too?

wight554 commented 2 years ago

@wight554 Thanks for the issue report. Did you by any chance check if the same behavior exists for the uniforms-material theme too?

99% sure it does. I've used unofficial MUI5 theme which was based on material-ui + codemod and it had same issues Edit: link