Skip to content

Commit

Permalink
React: Remove deprecated setGlobalConfig portable stories api
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Jan 4, 2024
1 parent 9ff64bc commit 645439a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
9 changes: 9 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- [Require Svelte 4 and up](#require-svelte-4-and-up)
- [Deprecations which are now removed](#deprecations-which-are-now-removed)
- [--use-npm flag in storybook CLI](#--use-npm-flag-in-storybook-cli)
- [`setGlobalConfig` from `@storybook/react`](#setglobalconfig-from-storybookreact)
- [From version 7.5.0 to 7.6.0](#from-version-750-to-760)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
Expand Down Expand Up @@ -573,6 +574,14 @@ Starting in 8.0, Storybook requires Svelte 4 and up.

The `--use-npm` is now removed. Use `--package-manager=npm` instead. [More info here](#cli-option---use-npm-deprecated).

##### `setGlobalConfig` from `@storybook/react`

The `setGlobalConfig` (used for reusing stories in your tests) is now removed in favor of `setProjectAnnotations`.

```ts
import { setProjectAnnotations } from `@storybook/testing-react`.
```

## From version 7.5.0 to 7.6.0

#### CommonJS with Vite is deprecated
Expand Down
12 changes: 0 additions & 12 deletions code/renderers/react/src/testing-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {
Store_CSFExports,
StoriesWithPartialProps,
} from '@storybook/types';
import { deprecate } from '@storybook/client-logger';

import { render } from './render';
import type { Meta } from './public-types';
Expand All @@ -37,17 +36,6 @@ export function setProjectAnnotations(
originalSetProjectAnnotations<ReactRenderer>(projectAnnotations);
}

/** Preserved for users migrating from `@storybook/testing-react`.
*
* @deprecated Use setProjectAnnotations instead
*/
export function setGlobalConfig(
projectAnnotations: ProjectAnnotations<ReactRenderer> | ProjectAnnotations<ReactRenderer>[]
) {
deprecate(`setGlobalConfig is deprecated. Use setProjectAnnotations instead.`);
setProjectAnnotations(projectAnnotations);
}

// This will not be necessary once we have auto preset loading
const defaultProjectAnnotations: ProjectAnnotations<ReactRenderer> = {
render,
Expand Down

0 comments on commit 645439a

Please sign in to comment.