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

Added migration guide from 3 to 4 to docs #1395

Open
wants to merge 2 commits into
base: docs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/docs/getting-started/custom-theme.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/getting-started/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: faq
title: FAQ
sidebar_position: 5
sidebar_position: 6
---

### How can I customize/style my form fields?
Expand Down
36 changes: 36 additions & 0 deletions website/docs/getting-started/migrating-3-to-4.md
Original file line number Diff line number Diff line change
@@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recommend using identical versions of all uniforms packages, so let's also point it out here so they won't use uniforms v4 with uniforms-material v3.

Suggested change
If you want to continue using these packages, you can use the following commands to download the latest version of the package:
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 latest version of the package:


```
npx gitget https://github.com/vazco/uniforms/tree/v3.10.2/packages/<uniforms-package-name>
```
Loading