Skip to content

Commit

Permalink
Addon Links: Remove LinkTo from direct import
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Jan 4, 2024
1 parent d2105f6 commit 37d5113
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
13 changes: 13 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- [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)
- [LinkTo direct import from addon-links](#linkto-direct-import-from-addon-links)
- [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 @@ -582,6 +583,18 @@ The `setGlobalConfig` (used for reusing stories in your tests) is now removed in
import { setProjectAnnotations } from `@storybook/testing-react`.
```

#### LinkTo direct import from addon-links

The `LinkTo` (React component) direct import from `@storybook/addon-links` is now removed. You have to import it from `@storybook/addon-links/react` instead.

```ts
// before
import LinkTo from '@storybook/addon-links';

// after
import LinkTo from '@storybook/addon-links/react';
```

## From version 7.5.0 to 7.6.0

#### CommonJS with Vite is deprecated
Expand Down
19 changes: 0 additions & 19 deletions code/addons/links/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
import { dedent } from 'ts-dedent';

let hasWarned = false;

/**
* @deprecated please import this specific function from @storybook/addon-links/react
*/
export function LinkTo(): null {
if (!hasWarned) {
// eslint-disable-next-line no-console
console.error(dedent`
LinkTo has moved to addon-links/react:
import LinkTo from '@storybook/addon-links/react';
`);
hasWarned = true;
}
return null;
}

export { linkTo, hrefTo, withLinks, navigate } from './utils';

0 comments on commit 37d5113

Please sign in to comment.