Migrating v3 to v4
This guide is designed to help you through the migration. If you went through it and encountered any problems - do let us know. For more information on why certain changes were made, see the CHANGELOG.md. When migrating to v4, use the newest version. Gradual updates will take more time and won't ease this process.
Breaking API changes
AutoFieldscomponent in all themes now renders aReact.Fragmentinstead of adiv. Explicitly render a wrapper component around if you need one.- Dropped support for
initialCountin bridges andListFields. Pass a model object to the form with the appropriate amount of initial items instead. - Removed the
autoFieldprop fromQuickForm,AutoForm, andAutoFieldscomponents in all themes. UseAutoField.componentDetectorContext.Providerinstead. componentDetectorinAutoFieldcomponents now always takes precedence overcomponentproperty on a schema. This may make yourAutoFieldrender a different component when you were using both previously. If that's the case, move your schema'scomponentdefinition to aAutoField.componentDetectorContext.Providerinstead.- The constructors for all our bridges now accept an object (e.g.,
{schema, validator}) instead of individual parameters. This applies toSimpleSchema2Bridge,JSONSchemaBridge, andZodBridge. Please update your constructor calls accordingly. getInitialValuereturns empty array or object instead ofundefinedforListFieldandNestField.Bridge.getPropsmethod accepts onlynameargument now. Additional arguments are no longer supported.- Replaced
allowedValueswithoptionsprop - AntD theme uses
v5ofantdpackage. Update your project to usev5ofantdpackage. - MUI theme uses
v6of@mui/materialpackage. Update your project to usev6of@mui/materialpackage. - Initial render doesn't trigger individual field
onChangefunctions anymore. #1343
Deprecated packages
The following packages are deprecated and are no longer supported in v4.0.0.
- Deprecate
uniforms-bootstrap3package - Deprecate
uniforms-materialpackage - Deprecate
uniforms-bridge-simple-schemapackage - Deprecate
uniforms-bridge-graphqlpackage
If you want to continue using these packages, we recommend staying with uniforms v3, as we don't guarantee they will work with the newer versions. You can use the following commands to download the 3.10.2 version of the package:
npx gitget https://github.com/vazco/uniforms/tree/v3.10.2/packages/<uniforms-package-name>