Skip to content

Commit

Permalink
Merge pull request #25418 from storybookjs/yann/remove-linkto-import
Browse files Browse the repository at this point in the history
Addon Links: Remove LinkTo from direct import
  • Loading branch information
yannbf authored Jan 4, 2024
2 parents cca26e9 + a576dc7 commit 7802938
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 @@ -32,6 +32,7 @@
- [`setGlobalConfig` from `@storybook/react`](#setglobalconfig-from-storybookreact)
- [StorybookViteConfig type from @storybook/builder-vite](#storybookviteconfig-type-from-storybookbuilder-vite)
- [props from WithTooltipComponent from @storybook/components](#props-from-withtooltipcomponent-from-storybookcomponents)
- [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 @@ -606,6 +607,18 @@ The deprecated properties `tooltipShown`, `closeOnClick`, and `onVisibilityChang
</WithTooltip>
```

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

Please sign in to comment.