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

Deep Linking: put path of component>story in the URL #674

Closed
dptoot opened this issue Jan 22, 2017 · 9 comments
Closed

Deep Linking: put path of component>story in the URL #674

dptoot opened this issue Jan 22, 2017 · 9 comments
Assignees
Milestone

Comments

@dptoot
Copy link

dptoot commented Jan 22, 2017

Forgive me if I am missing the obvious.

I see that deep linking has been available since #6 but I can't seem to find any documentation on how it is actually achieved.

I can see the generated query string but unless it is re-used in its entirety then the app just falls back to the first story. I would have thought ?selectedKind=Button would at least bring me to the Button section.

is there any way to currently achieve deep linking within react-storybook?

@marc-rutkowski
Copy link

@dptoot Maybe this is what you are looking for? https://github.com/storybooks/storybook-addon-links

@dptoot
Copy link
Author

dptoot commented Feb 1, 2017

Thanks Marc, but what I am looking for is external links into react-storybook. My hope would be that http://localhost:9001/?selectedKind=Button would bring me to the initial story of button component but in actuality it will render the first story of the first component in the list.

I am trying to utilize react-storybook as a styleguide and being able to give user links that direct them directly to particular components and stories would be very helpful

@marc-rutkowski
Copy link

Sorry, didn't understand your question correctly.

Seems you need to provide at least the selectedStory parameter along with selectedKind to have it to work.
Is it a problem for your use case?

If so maybe we can submit a PR for this?
I think this test can be changed to return the first story of a kind if the selectedStory is missing or if the specified story is not found.

@arunoda any advice with this?

@dptoot
Copy link
Author

dptoot commented Feb 2, 2017

@marc-rutkowski

Thanks! That actually does work for my use case as I have a standard naming convention for the initial story for each component story set. I would posit that that can't be relied on for everyuser though. I lucked out. Humbly, and without looking too much into the source code, I would say the expectation would be that only selectedKind be required to link into the storybook and the default selectedStory would fall back back to the first story in the story array, if not supplied. I would be happy to help out on a PR if @arunoda thinks this is the direction he would like to take things.

@tmeasday
Copy link
Member

This seems like a reasonable feature. See also #614.

@ndelangen ndelangen modified the milestone: v3.0.0 Apr 2, 2017
@ndelangen ndelangen added the ready label Apr 2, 2017
@ndelangen ndelangen modified the milestones: v3.0.0, v3.1.0 Apr 2, 2017
@ndelangen ndelangen changed the title Deep Linking Deep Linking: put path of component>story in the URL Apr 5, 2017
@tmeasday tmeasday self-assigned this Apr 5, 2017
tmeasday added a commit to storybook-eol/storybook-ui that referenced this issue Apr 6, 2017
@tmeasday
Copy link
Member

tmeasday commented Apr 6, 2017

See linked PR (storybook-eol/storybook-ui#78)

@tmeasday
Copy link
Member

This is merged and will be released w/ version 3.0

@tmeasday tmeasday removed the ready label May 15, 2017
@shilman shilman modified the milestones: v3.0.0, v3.1.0 Jun 5, 2017
@NicoleGrondinAlayacare
Copy link

This seems to have regressed with version 5.0.0. Are there any plans to fix this?

@shilman
Copy link
Member

shilman commented Mar 6, 2019

Thanks for the bug @NicoleGrondinAlayacare -- tracking it here: #5925

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

6 participants