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

React: Remove deprecated setGlobalConfig portable stories api #25442

Merged
merged 1 commit into from
Jan 4, 2024
Merged
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
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