Storybook: import { object } from '@storybook/addon-knobs/angular' throw error

Created on 17 Jan 2019  路  10Comments  路  Source: storybookjs/storybook

Describe the bug
When using import { object } from '@storybook/addon-knobs/angular';
and creating an object (for example: ), the following error is outputting to the console.

Warning: `ObjectType` uses `getDerivedStateFromProps` but its initial state is undefined. This is not recommended. Instead, define the initial state by assigning an object to `this.state` in the constructor of `ObjectType`. This ensures that `getDerivedStateFromProps` arguments have a consistent shape.

To Reproduce

  1. Import object from '@storybook/addon-knobs/angular'
  2. create a new object
  3. run storybook
  4. See the error in the console

Expected behavior
there shouldn't be any error.

System:

  • OS:MacOS
  • Device: Macbook Pro 2018
  • Browser: chrome
  • Framework: angular
  • Addons: [ knobs ]
  • Version: 4.1.6
knobs bug patch picked

Most helpful comment

I am also mess the same trouble, but with React.

All 10 comments

I have the same error ( importing { object } from @storybook/addon-knobs of version 4.0.9) in development mode. Clearly, ObjectType component does not have initial state.

Same thing for me, except using

import { object } from "@storybook/addon-knobs"

鈥nd using Vue framework on the same specs running 4.2.0-alpha.11.

I am also mess the same trouble, but with React.

I have the same problem here with React

I have the same problem with Vue
@storybook/addon-knobs 4.1.11

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!

Running into this with Storybook for our React components. Versions:

    "@storybook/addon-actions": "4.0.12",
    "@storybook/addon-knobs": "4.1.4",
    "@storybook/addon-notes": "4.1.4",
    "@storybook/addons": "4.0.12",
    "@storybook/react": "4.0.12",

Also having the same bug
Versions:

    "@storybook/addon-actions": "^5.0.0",
    "@storybook/addon-info": "^5.0.0",
    "@storybook/addon-knobs": "^5.0.0",
    "@storybook/addon-links": "^5.0.0",
    "@storybook/addon-options": "^5.0.0",
    "@storybook/addons": "^5.0.0",
    "@storybook/react": "^5.0.0",
    "@storybook/theming": "^5.0.0",

w00t!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.13 containing PR #6159 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

Ooh-la-la!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.4 containing PR #6159 that references this issue. Upgrade today to try it out!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xogeny picture xogeny  路  3Comments

miljan-aleksic picture miljan-aleksic  路  3Comments

wahengchang picture wahengchang  路  3Comments

MrOrz picture MrOrz  路  3Comments

purplecones picture purplecones  路  3Comments