question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding a link breaks docs page in composition host storybook

See original GitHub issue

After upgrading from v5 to v6, and implementing the composition feature, it looks like links in the different docs page in the storybooks breaks the host storybook.

The error thrown:

Uncaught DOMException: Blocked a frame with origin "http://localhost:6002" from accessing a cross-origin frame.
    at Link (http://localhost:6002/vendors~main.2fda63c8d929018b1d7c.bundle.js:77355:88)

Removing the link in the story fixes the issue.

I’ve tried two ways of adding links to the docs page: one with markup and then other is jsx a href and both breaks the docs page in the host storybook.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ndelangencommented, Nov 2, 2020

I think the link component should be changed to:

const Link: FunctionComponent<any> = ({ href: input, children, ...props }) => {
  const isStorybookPath = /^\//.test(input);
  const isAnchorUrl = /^#.*/.test(input);

  const href = isStorybookPath ? `?path=${input}` : input;
  const target = isAnchorUrl ? '_self' : '_top';

  return (
    <a href={href} target={target} {...props}>
      {children}
    </a>
  );
};

@dvh91 would you be able to open a PR changing this?

0reactions
shilmancommented, Jan 11, 2021

Crikey!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.12 containing PR #13022 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure Storybook
Configure Storybook. Storybook is configured via a folder called .storybook , which contains various configuration files. Note that you can change the folder ......
Read more >
DocsPage - Storybook - JS.ORG
It aggregates your stories, text descriptions, docgen comments, args tables, and code examples into a single page for each component. The best practice...
Read more >
Frequently Asked Questions - Storybook - JS.ORG
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
Storybook Addon Next
Per-story overrides can be done by adding a nextRouter property onto the story parameters. The addon will shallowly merge whatever you put here...
Read more >
Write an addon - Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found