storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.69k stars 9.32k forks source link

'TypeError: decorated is not a function' - error while upgrading to 5 #7115

Closed kon-rad closed 5 years ago

kon-rad commented 5 years ago

Describe the bug Attempting to update from 3.4.7 to 5.1.8 (also previously attempted update to 4.1.6 but had the same error)

To Reproduce Steps to reproduce the behavior:

  1. Followed instructions on medium post on updating to 4 and to 5
  2. installed updated versions
  3. run storybook
  4. See error
    TypeError: decorated is not a function
    at client_api.js:120
    at withSubscriptionTracking (client_api.js:150)
    at client_api.js:118
    at storyFn (story_store.js:357)
    at renderMain (render.js:65)
    at renderMain (start.js:205)
    at StoryStore.renderUI (start.js:231)
    at StoryStore.emit (index.js:180)
    at story_store.js:239

Expected behavior Storybook should work.

Screenshots

storybook-upgrade

Code snippets Currently only attempting to load storybook with only one component in order to isolate where it breaks:

function loadStories() {
  require('../docs/Button/Button.story');
}

The code breaks when attempting to load any storybook 'storiesOf' component.

package.json

{
  <redacted>,
  <redacted>,
  "publishConfig": {
    <redacted>
  },
  "main": "docs/index.js",
  "module": "docs/index.js",
  "private": true,
  "scripts": {
    "storybook": "start-storybook -p 9009 -s ../../public",
    "build-storybook": "build-storybook -s ../../public -o ../../storybook-static",
    "link-packages": "npm link ../core"
  },
  "files": [
    "dist"
  ],
  "devDependencies": {
    "@babel/cli": "^7.4.4",
    "@babel/core": "^7.4.5",
    "@babel/plugin-proposal-object-rest-spread": "^7.4.4",
    "@babel/plugin-transform-modules-commonjs": "^7.4.4",
    "@babel/plugin-transform-runtime": "^7.4.4",
    "@babel/preset-env": "^7.4.5",
    "@babel/preset-react": "^7.0.0",
    "@babel/runtime": "^7.4.5",
    "@storybook/addon-actions": "^5.1.8",
    "@storybook/addon-info": "5.1.8",
    "@storybook/addon-links": "5.1.8",
    "@storybook/addon-notes": "5.1.8",
    "@storybook/addon-options": "5.1.8",
    "@storybook/addons": "5.1.8",
    "@storybook/cli": "5.1.8",
    "@storybook/react": "5.1.8",
    "autoprefixer": "6.7.2",
    "babel-loader": "^8.0.6",
    "clean-webpack-plugin": "^0.1.16",
    "css-loader": "^0.28.4",
    "enzyme": "^2.9.1",
    "eslint": "^4.16.0",
    "eslint-config-prettier": "^2.9.0",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-jest": "storybook/addon-info^20.0.3",
    "eslint-plugin-prettier": "^2.5.0",
    "eslint-plugin-react": "^7.5.1",
    "prettier": "^1.11.1",
    "source-map-loader": "^0.2.3"
  },
  "dependencies": {
    <redacted>,
    "@storybook/node-logger": "5.1.8",
    "classnames": "^2.2.5",
    "downshift": "1.16.2",
    "fuse.js": "3.4.2",
    "prop-types": "^15.5.10",
    "react": "^16.6.3",
    "react-addons-css-transition-group": "15.6.0",
    "react-dom": "^16.7.0",
    "react-dropzone-component": "^2.0.0",
    "react-input-autosize": "^2.0.1",
    "react-modal": "^3.1.10",
    "react-proptype-conditional-require": "^1.0.4",
    "react-tabs": "^1.1.0",
    "react-toastify": "^4.0.0-rc.5",
    "react-waypoint": "^7.3.1",
    "react-widgets": "^4.0.0",
    "react-widgets-moment": "^4.0.0",
    "shortid": "^2.2.8"
  },
  "peerDependencies": {
    "moment": "^2.19.2",
    "react": "~16.3.2",
    "react-dom": "~16.2.0"
  }
}

System:

Additional context updated to babel 7 in custom webpack.config.js file

kon-rad commented 5 years ago

This was resolved. For anyone that may find this helpful; the issue was passing a non function as the second argument to .add() method.