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

UI: Fix viewMode parameter handling #10292

Merged
merged 6 commits into from
Apr 24, 2020
Merged

UI: Fix viewMode parameter handling #10292

merged 6 commits into from
Apr 24, 2020

Conversation

ndelangen
Copy link
Member

Issue: #10233

What I did

Made a change in lib/api/modules/stories so when navigating to a story, the parameter is read and preferred over the current state

WDYT @jonhuteau ?

@ndelangen ndelangen added this to the 6.0 milestone Apr 2, 2020
@ndelangen ndelangen self-assigned this Apr 2, 2020
@jonhuteau
Copy link

Looks good to me. So it will be possible to define viewMode in these cases ?

// my-component.stories.js

playground.story = {
  parameters: {
    viewMode: 'story',
  },
}
// my-component.stories.mdx

<Meta
  title='Packages/MyComponent'
  component={MyComponent}
  parameters={{ viewMode: 'docs' }}
/>

@shilman shilman changed the title Respect parameter viewMode over current state UI: Fix viewMode parameter handling Apr 3, 2020
@shilman shilman changed the title UI: Fix viewMode parameter handling UI: Fix viewMode parameter handling Apr 3, 2020
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good conceptually, but maybe buggy?

lib/api/src/modules/stories.ts Outdated Show resolved Hide resolved
lib/api/src/lib/stories.ts Outdated Show resolved Hide resolved
@ndelangen ndelangen requested a review from shilman April 16, 2020 11:08
@ndelangen
Copy link
Member Author

Seems to work to me:
https://deploy-preview-10292--storybookjs.netlify.app/official-storybook/?path=/docs/addons-docs-buttongroup--basic

Try navigating to a different story, click canvas, then navigate to that story again, it switching you to viewMode=docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants