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

addon-docs: Failed prop type: Invalid prop viewMode of value docs supplied to Preview, expected one of ["story","info"]. #7988

Closed
alisonsayarath opened this issue Sep 4, 2019 · 7 comments

Comments

@alisonsayarath
Copy link

alisonsayarath commented Sep 4, 2019

Describe the bug
When using addon-docs with MDX, my component in the Canvas tab is shown, but nothing in the Docs tab shows.

To Reproduce
Configure the new Storybook beta with docs-addon while adding those presets :

module.exports = [
  {
    name: "@storybook/addon-docs/react/preset",
    options: {
      configureJSX: true,
      sourceLoaderOptions: null,
    },
  },
];

Versions :

  • @storybook/react": "^5.2.0-beta.32"
  • @storybook/addon-docs: "^5.2.0-beta.32",

Screenshots

Story base.story.mdx :

Screenshot 2019-09-04 at 15 31 54

Config config.js :

Screenshot 2019-09-04 at 15 33 41

My component shows well in the Canvas tab, however, when I go to the Docs tab, I am having the following errors :

Screenshot 2019-09-04 at 15 35 03

@alisonsayarath alisonsayarath changed the title addon-docs Failed prop type: Invalid prop viewMode of value docs supplied to Preview, expected one of ["story","info"]. addon-docs: Failed prop type: Invalid prop viewMode of value docs supplied to Preview, expected one of ["story","info"]. Sep 4, 2019
@shilman
Copy link
Member

shilman commented Sep 4, 2019

@alisonsayarath That error looks like you're somehow using an old version of Storybook. Can you:

  1. Make sure @storybook/* in package.json are all at the same version
  2. If they are, remove node_modules and (and possibly your .lock file) and reinstall
  3. Try yarn list @storybook/ui to make there's only one version and it's the same version.

Also, I'd recommend upgrading to 5.2.0-rc.5 (the latest), but that's not related to your problem here.

@alisonsayarath
Copy link
Author

Thanks for the quick answer!

And it shows two versions :

We have two version because we use a custom CRA (so we had to fork the 5.1.11 to make our command yarn storybook work). We better wait until Docs are not beta anymore 🤕

@lonyele
Copy link
Member

lonyele commented Sep 4, 2019

@shilman yeah, it's been awhile seeing these errors. Probably when addon architecture or the routing architecture was changed. Maybe little bit more info from #7241

What is missing here(TODO)
I think the following PR is needed to resolve this issue of PropType warnings by getting the lists of possible viewMode from all the registered addons and others for strongly type viewMode.

@shilman
Copy link
Member

shilman commented Sep 5, 2019

@alisonsayarath why did you need to fork it? that will def cause problems. docs should be stable release in the next two weeks.

@shilman
Copy link
Member

shilman commented Sep 5, 2019

@lonyele Yeah those routes were hard-coded in 5.0 due to lack of time. And I think they are hard-coded again in 5.2. But we expect our users to use the same version of our libraries, and don't make guarantees if they are not. This is not pure semver, but practically speaking it's worked for us so far aside from this kind of case (e.g. people mixing 5.1 & 5.2 together), which unfortunately happens fairly often.

@renatoholanda
Copy link

I change all in the same version on package.json and it works.

{
// ...
"@storybook/addon-actions": "^5.2.0-rc.5", // was 5.1.11
"@storybook/addon-docs": "^5.2.0-rc.5", 
"@storybook/addon-links": "^5.2.0-rc.5", // was 5.1.11
"@storybook/addons": "^5.2.0-rc.5", // was 5.1.11
"@storybook/react": "^5.2.0-rc.5" // was 5.1.11
// ...
}

@alisonsayarath
Copy link
Author

@alisonsayarath why did you need to fork it? that will def cause problems. docs should be stable release in the next two weeks.

Oups, sorry for the late answer. We have multiple CRA base config modes.

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

4 participants