-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
MDX links to stories should use Storybook API instead of doing a full refresh. #9328
Comments
Here's a few pointers to implement this: The following code should be updated: https://github.com/storybookjs/storybook/blob/next/addons/docs/src/blocks/mdx.tsx#L98 It currently append the Manager iframe hostname to the every local URL. This component is rendered through custom components feature.. Docs available here: https://mdxjs.com/advanced/components The code providing the custom components is here: https://github.com/storybookjs/storybook/blob/next/addons/docs/src/blocks/DocsContainer.tsx#L20 To test the feature, you can use the official-storybook. The story |
@patricklafrance internal anchors might not work, for example the
Also its probably best to just keep the Here is what I tried let me know what you think:
|
That's a good point @atanasster I haven't though about the fact that local anchors might not work after switching to SB API. From a usage standpoint, it seems very important to me. As a documentation writer, when I link to another page, my intent is almost always to link to a specific section of that page. @shilman a few days ago on discord you were mentioning new API that we could add to navigate to an anchor, could it also apply to this? @atanasster could you develop on this?
From a user standpoint IMO it would be nice if we could simplify the link to provide. Instead of:
I would rather define:
|
‘ /addons-docs-docs-only--page#bottom’ Yes, that works |
I checked in the changes, so we can get a conversation going. Currently looks for href starting with
|
That's a very good idea. Using I don't see any reason to support |
Potentially just as a fallback if the storyId is not found in the storyStore. Not sure why :) @shilman feedback? |
I am not sure the storyId will exist in the storyStore if it's a docs only page. I add to take that into account in #9331 |
It might be fine though since it's not the same scope? I am not very familiar with the |
Tried those two and both work (there is a story in the storyStore for the docs only afaics) :
|
Lets wait for feedback, and I guess we can change it to |
Sounds good! |
Still need to figure out how to support local anchors though |
Great progress guys. Some thoughts: Re: Re: anchors. The current anchor code triggers a CORS error in "standalone mode" because the preview iframe tries to refer to the parent iframe's URL, which is only valid if the two URLs are on the same host/port. So I proposed adding a new event that the preview can use to trigger an anchor change in the manager to overcome that problem. This event might also be used to solve this issue. |
Thanks for your feedback @shilman For |
Another proposition: Instead of That way it's still follow URL syntax. The code could:
|
so imho this [link to another story](/?path=/addons-docs-docs-only--page) is good enough for now... Rationals against:
|
This feature hasn't been released yet so I don't consider this to be a breaking change. IMO, introducing Anyway, it could be |
I would support more the syntax:
since I agree with patrick's side that the final say @shilman ? |
I'm with @daKmoR on this one. If we include the I'd be open to reconsidering this if there were more good reasons to add it, but really not a fan of inventing new syntax when there's already a widely supported standard. |
@shilman - sounds good, the PR is already with |
The SELECT_STORY api is already in the manager, does the above note apply to the current issue for using the API? |
Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-rc.13 containing PR #9381 that references this issue. Upgrade today to try it out! You can find this prerelease on the Closing this issue. Please re-open if you think there's still more to do. |
I don't think this should have been closed. When linking from a story to another a full refresh is still performed in 6.0.1. My mistake a full refresh only happens when putting the link in a comment i'll open an issue. |
Can anyone tell me if this feature is supposed to close the SB viewer in Angular? If I use this link to go from the stories doc page to an MDX file in the same folder, It opens a new page with the MDX shown but without the storybook viewer. The page it goes to is http://localhost:6006/iframe.html?id=basin-components-list-item-list-item-mdx--page&viewMode=story There is no list of stories to the side or controls below, no window into viewing the page, just the MDX page itself. I would like to be able to link the two without completely removing the viewer from Storybook |
linking to docs/story page, from another story, is broken for me. I hesitate to make a new issue for this, please let me know if a new issue is necessary. using
based on this commit, which is this page, i should be able to make a link from 1 story to a docs page/story like this - and sure, i can link to the |
+1 for this. @Pickra — Did you find a solution or workaround for this? |
@mel-miller i think you exclude |
Thanks @Pickra. But, I can't get that to work. I'm going to keep digging. |
+1 |
Any news on this? I just tried to link to a documentation page [text component](/docs/components-text--default-story#properties) and it causes Storybook to load this URL:
which results in a completely blank page and a console error:
|
Sorry if this has been noted somewhere, but I have the same issue as @franktopel above and can't find any documentation on how to cross-link between .mdx doc page files using Markdown syntax and not have the Storybook screen do a full refresh. Is there a different format of link string or an addon that should be used? |
Is your feature request related to a problem? Please describe.
The current version of MDX linkings support links to other stories though full refresh.
This is quite slow and doesn't leverage existing Storybook API.
Describe the solution you'd like
MDX linkings should emit a
SELECT_STORY
event to navigate to another story.The text was updated successfully, but these errors were encountered: