From 893f87012ce76e297209dceb89ae015a38682668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Po=C5=9Bpiech?= <37746259+piotrpospiech@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:27:14 +0100 Subject: [PATCH 1/2] added migratiom guide from 3 to 4 --- website/docs/getting-started/custom-theme.md | 2 +- .../docs/getting-started/migrating-3-to-4.md | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 website/docs/getting-started/migrating-3-to-4.md diff --git a/website/docs/getting-started/custom-theme.md b/website/docs/getting-started/custom-theme.md index 737236243..3bb699aa7 100644 --- a/website/docs/getting-started/custom-theme.md +++ b/website/docs/getting-started/custom-theme.md @@ -1,7 +1,7 @@ --- id: custom-theme title: Custom theme -sidebar_position: 4 +sidebar_position: 5 --- We've made hundreds of custom components across dozens of projects, including complete custom themes. Most of them began as source forks of `uniforms-unstyled` - one simply copies the source and imports `./some/project/path/uniforms-custom-theme-with-a-cool-name`. diff --git a/website/docs/getting-started/migrating-3-to-4.md b/website/docs/getting-started/migrating-3-to-4.md new file mode 100644 index 000000000..5d45d263e --- /dev/null +++ b/website/docs/getting-started/migrating-3-to-4.md @@ -0,0 +1,36 @@ +--- +id: migrating-4-to-4 +title: Migrating v3 to v4 +sidebar_position: 4 +--- + +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](https://github.com/vazco/uniforms/blob/master/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 + +- `AutoFields` component in all themes now renders a `React.Fragment` instead of a `div`. Explicitly render a wrapper component around if you need one. +- Dropped support for `initialCount` in bridges and `ListField`s. Pass a model object to the form with the appropriate amount of initial items instead. +- Removed the `autoField` prop from `QuickForm`, `AutoForm`, and `AutoFields` components in all themes. Use `AutoField.componentDetectorContext.Provider` instead. +- `componentDetector` in `AutoField` components now always takes precedence over `component` property on a schema. This may make your `AutoField` render a different component when you were using both previously. If that's the case, move your schema's `component` definition to a `AutoField.componentDetectorContext.Provider` instead. +- The constructors for all our bridges now accept an object (e.g., `{schema, validator}`) instead of individual parameters. This applies to `SimpleSchema2Bridge`, `JSONSchemaBridge`, and `ZodBridge`. Please update your constructor calls accordingly. +- `getInitialValue` returns empty array or object instead of `undefined` for `ListField` and `NestField`. +- `Bridge.getProps` method accepts only `name` argument now. Additional arguments are no longer supported. +- Replaced `allowedValues` with `options` prop +- AntD theme uses `v5` of `antd` package. Update your project to use `v5` of `antd` package. +- MUI theme uses `v6` of `@mui/material` package. Update your project to use `v6` of `@mui/material` package. +- Initial render doesn't trigger individual field `onChange` functions anymore. [#1343](https://github.com/vazco/uniforms/pull/1343) + +## Deprecated packages + +The following packages are deprecated and are no longer supported in v4.0.0. + +- Deprecate `uniforms-bootstrap3` package +- Deprecate `uniforms-material` package +- Deprecate `uniforms-bridge-simple-schema` package +- Deprecate `uniforms-bridge-graphql` package + +If you want to continue using these packages, you can use the following commands to download the latest version of the package: + +``` +npx gitget https://github.com/vazco/uniforms/tree/v3.10.2/packages/ +``` From 60d43a9cf602ea5de81af401e5c5e303a2371dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Po=C5=9Bpiech?= <37746259+piotrpospiech@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:28:02 +0100 Subject: [PATCH 2/2] update order of pages in getting started --- website/docs/getting-started/faq.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/getting-started/faq.mdx b/website/docs/getting-started/faq.mdx index 47229b844..162506a1f 100644 --- a/website/docs/getting-started/faq.mdx +++ b/website/docs/getting-started/faq.mdx @@ -1,7 +1,7 @@ --- id: faq title: FAQ -sidebar_position: 5 +sidebar_position: 6 --- ### How can I customize/style my form fields?