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 470d2c8 commit c4b967a
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 @@ -31,6 +31,7 @@
- [--use-npm flag in storybook CLI](#--use-npm-flag-in-storybook-cli)
- [`setGlobalConfig` from `@storybook/react`](#setglobalconfig-from-storybookreact)
- [StorybookViteConfig type from @storybook/builder-vite](#storybookviteconfig-type-from-storybookbuilder-vite)
- [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 @@ -591,6 +592,18 @@ The `StorybookViteConfig` type is now removed in favor of `StorybookConfig`:
import type { StorybookConfig } from '@storybook/react-vite';
```

#### 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 c4b967a

Please sign in to comment.