Storybook: addon-info throws error with styled-components

Created on 21 Aug 2019  路  6Comments  路  Source: storybookjs/storybook

Describe the bug
The withInfo addon throws a javascript error when attempting to render prop documentation for styled-components

To Reproduce
Steps to reproduce the behavior:

  1. clone https://github.com/adammlr/storybook-bug
  2. yarn storybook
  3. No errors on the console
  4. Click on Button - With Text Story
  5. Javascript error in console (see below) and Props are not documented fully (compare to Container story)

Error: checkPropTypes.js:20 Warning: Failed prop type: Invalid prop type of type object supplied to TableComponent, expected function.
in TableComponent (created by Story)

Expected behavior
Prop Type documentation generated without error

Screenshots
image
image

Code snippets

import styled from "styled-components";
import PropTypes from "prop-types";

const Button = styled.button`
  background: white;
  border: solid 1px black;
  color: black;
`;

Button.displayName = "Button";
Button.propTypes = {
  size: PropTypes.oneOf(["small", "large"])
};

export default Button;
storiesOf("Container", module)
  .addDecorator(withInfo)
  .add("with text", () => <Container>Container</Container>);

storiesOf("Button", module)
  .addDecorator(withInfo)
  .add("with text", () => (
    <Button onClick={action("clicked")}>Hello Button</Button>
  ));

System:
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 8.12.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.13.0 - C:\Program Files\nodejs\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
@storybook/addon-actions: ^5.1.11 => 5.1.11
@storybook/addon-info: ^5.1.11 => 5.1.11
@storybook/addon-links: ^5.1.11 => 5.1.11
@storybook/addons: ^5.1.11 => 5.1.11
@storybook/react: ^5.1.11 => 5.1.11

Additional context
Add any other context about the problem here.

info inactive question / support

All 6 comments

Same mistakes (in console, in storyshot too), with latest versions of storybook and add-ons (info, knobs, storyshot).
I just add withInfo decorator, 3 warnings Invalid prop ... appear :

Capture d鈥檈虂cran 2019-08-22 a虁 16 06 04

Context :

    "@storybook/addon-info": "5.1.11",
    "@storybook/addon-knobs": "5.1.11",
    "@storybook/addon-storyshots": "5.1.11",
    "@storybook/react": "5.1.11",

Addon-info is being superceded by addon-docs, which fixes a bunch of bugs and is easier to maintain. Please give it a try! https://medium.com/storybookjs/storybook-docspage-e185bc3622bf

@shilman thanks for the information.
But it's for Storybook 5.2 beta (which is not the latest).

@JBustin will be released this month

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Closing due to moving to addon-docs

Was this page helpful?
0 / 5 - 0 ratings