diff --git a/MIGRATION.md b/MIGRATION.md index ad2102dca7fa..9426f71bf721 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -4,10 +4,10 @@ - [Webpack 5 manager build](#webpack-5-manager-build) - [Angular 12 upgrade](#angular-12-upgrade) - [Lit support](#lit-support) + - [No longer inferring default values of args](#no-longer-inferring-default-values-of-args) - [6.3 deprecations](#63-deprecations) - [Deprecated addon-knobs](#deprecated-addon-knobs) - [Deprecated scoped blocks imports](#deprecated-scoped-blocks-imports) - - [Deprecated `argType.defaultValue`](#deprecated-argtypedefaultvalue) - [Deprecated layout URL params](#deprecated-layout-url-params) - [From version 6.1.x to 6.2.0](#from-version-61x-to-620) - [MDX pattern tweaked](#mdx-pattern-tweaked) @@ -212,34 +212,13 @@ To do so, it relies on helpers added in the latest minor versions of `lit-html`/ According to the package manager you are using, it can be handled automatically when updating Storybook or can require to manually update the versions and regenerate the lockfile. -### 6.3 deprecations - -#### Deprecated addon-knobs - -We are replacing `@storybook/addon-knobs` with `@storybook/addon-controls`. - -- [Rationale & discussion](https://github.com/storybookjs/storybook/discussions/15060) -- [Migration notes](https://github.com/storybookjs/storybook/blob/next/addons/controls/README.md#how-do-i-migrate-from-addon-knobs) - -#### Deprecated scoped blocks imports - -In 6.3, we changed doc block imports from `@storybook/addon-docs/blocks` to `@storybook/addon-docs`. This makes it possible for bundlers to automatically choose the ESM or CJS version of the library depending on the context. - -To update your code, you should be able to global replace `@storybook/addon-docs/blocks` with `@storybook/addon-docs`. Example: - -```js -// before -import { Meta, Story } from '@storybook/addon-docs/blocks'; - -// after -import { Meta, Story } from '@storybook/addon-docs'; -``` - -#### Deprecated `argType.defaultValue` +### No longer inferring default values of args Previously, unset `args` were set to the `argType.defaultValue` if set or inferred from the component's prop types (etc.). In 6.3 we no longer infer default values and instead set arg values to `undefined` when unset, allowing the framework to supply the default value. -If you were using `argType.defaultValue` to fix issues with the above inference, it should no longer be necessary, you can remove that code. If you were using it to set a default value for an arg, there is a simpler way; simply set a value for the arg at the component level: +If you were using `argType.defaultValue` to fix issues with the above inference, it should no longer be necessary, you can remove that code. + +If you were using `argType.defaultValue` or relying on inference to set a default value for an arg, you should now set a value for the arg at the component level: ```js export default { @@ -263,6 +242,29 @@ export default { }; ``` +### 6.3 deprecations + +#### Deprecated addon-knobs + +We are replacing `@storybook/addon-knobs` with `@storybook/addon-controls`. + +- [Rationale & discussion](https://github.com/storybookjs/storybook/discussions/15060) +- [Migration notes](https://github.com/storybookjs/storybook/blob/next/addons/controls/README.md#how-do-i-migrate-from-addon-knobs) + +#### Deprecated scoped blocks imports + +In 6.3, we changed doc block imports from `@storybook/addon-docs/blocks` to `@storybook/addon-docs`. This makes it possible for bundlers to automatically choose the ESM or CJS version of the library depending on the context. + +To update your code, you should be able to global replace `@storybook/addon-docs/blocks` with `@storybook/addon-docs`. Example: + +```js +// before +import { Meta, Story } from '@storybook/addon-docs/blocks'; + +// after +import { Meta, Story } from '@storybook/addon-docs'; +``` + #### Deprecated layout URL params Several URL params to control the manager layout have been deprecated and will be removed in 7.0: