Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"View external Storybook" link broken for URLs with a directory #12659

Closed
marksmccann opened this issue Oct 4, 2020 · 5 comments
Closed

"View external Storybook" link broken for URLs with a directory #12659

marksmccann opened this issue Oct 4, 2020 · 5 comments

Comments

@marksmccann
Copy link
Contributor

marksmccann commented Oct 4, 2020

Is your feature request related to a problem? Please describe

We are using Storybook Composition to import an app located in a directory on the domain (e.g. http://www.domain.com/storybook-app/) instead of the root (e.g. http://www.domain.com). Our configuration looks something like this:

refs: {
    'design-system': {
        title: "Storybook Design System",
        url: "https://www.domain.com/my-storybook-app/"
    }
}

With this type of url, the app successfully imports the external app however, the link to "View external Storybook" does not work. The link points to "https://www.domain.com/my-storybook-app" instead of "https://www.domain.com/my-storybook-app/". Because the trailing / is missing, the browser fails to load the app.

Screen Shot 2020-10-03 at 8 34 03 PM

Describe the solution you'd like

I would like to append a trailing forward slash (/) to the "View external Storybook" link in the ref indicator flyout so that the link will successfully open a storybook app located in a directory of a URL.

Describe alternatives you've considered

These are the ways I have tried to make it work:

  • Appending / in the configuration does not work. It is stripped from the url automatically.
  • Appending /index.html fixes the link, but then the app fails to load in the left-hand nav.
  • Escaping the / also does not work (e.g. \/ or \\/).

These are the possible solutions I have considered:

  • Append / to the end of the url for the link's href.
  • Append /index.html to the end of the url for the link's href.
  • Strip the basename off the url before retrieving the stories.json config from the domain.

Are you able to assist to bring the feature to reality?

Yes, I'd love to help. However, I would like your opinion on the most desirable solution and a little direction on how best to proceed. Thanks!

@ndelangen
Copy link
Member

@marksmccann I think if we append /index.html here:

<Message href={url} target="_blank">

It should fix this issue.

@marksmccann
Copy link
Contributor Author

@ndelangen Agreed. Would you like me to put a PR together?

@ndelangen
Copy link
Member

@marksmccann yeah that'd be super appreciated !

@marksmccann
Copy link
Contributor Author

@ndelangen Great, I'm on it!

@shilman
Copy link
Member

shilman commented Nov 1, 2020

Yo-ho-ho!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.0-alpha.34 containing PR #12932 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants