From 645439adfbb543b5dadb28a471f2da7166c1c6b1 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Wed, 3 Jan 2024 15:36:54 -0300 Subject: [PATCH] React: Remove deprecated setGlobalConfig portable stories api --- MIGRATION.md | 9 +++++++++ code/renderers/react/src/testing-api.ts | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 6e673bbea530..20cdbd102b04 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -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) @@ -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 diff --git a/code/renderers/react/src/testing-api.ts b/code/renderers/react/src/testing-api.ts index 545147fab2db..385e0dc4c804 100644 --- a/code/renderers/react/src/testing-api.ts +++ b/code/renderers/react/src/testing-api.ts @@ -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'; @@ -37,17 +36,6 @@ export function setProjectAnnotations( originalSetProjectAnnotations(projectAnnotations); } -/** Preserved for users migrating from `@storybook/testing-react`. - * - * @deprecated Use setProjectAnnotations instead - */ -export function setGlobalConfig( - projectAnnotations: ProjectAnnotations | ProjectAnnotations[] -) { - deprecate(`setGlobalConfig is deprecated. Use setProjectAnnotations instead.`); - setProjectAnnotations(projectAnnotations); -} - // This will not be necessary once we have auto preset loading const defaultProjectAnnotations: ProjectAnnotations = { render,