Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

v1.1.2 breaking change #29

Closed
majapw opened this issue Mar 21, 2017 · 5 comments
Closed

v1.1.2 breaking change #29

majapw opened this issue Mar 21, 2017 · 5 comments

Comments

@majapw
Copy link

majapw commented Mar 21, 2017

I'm still investigating, but #24 appears to have broken our storybook. Specifically we're seeing:

Cannot read property 'replace' of undefined
TypeError: Cannot read property 'replace' of undefined
    at action (webpack:///./~/@kadira/storybook-addon-actions/dist/preview.js?:52:20)
    at exports.default (webpack:///./examples/AttributeToggleRow_example.jsx?:137:19)
    at eval (webpack:///./story/story.jsx?:33:23)
    at Array.forEach (native)
    at Object.eval (webpack:///./story/story.jsx?:25:29)
    at eval (webpack:///./story/story.jsx?:81:30)
    at Object.<anonymous> (http://localhost:9001/static/preview.bundle.js:11745:2)
    at __webpack_require__ (http://localhost:9001/static/preview.bundle.js:556:30)
    at fn (http://localhost:9001/static/preview.bundle.js:87:20)
    at webpackContext (webpack:///./story_^\.\/.*\.jsx$?:6:9)

Which suggests that name in https://github.com/storybooks/storybook-addon-actions/blob/master/src/preview.js#L30 is undefined. We're going to peg to the previous version for now while we investigate, but I wanted to open this issue for tracking.

@majapw
Copy link
Author

majapw commented Mar 21, 2017

All right, so this is exposing a problem on our end. If you call action without an argument now (ie onClick={action()}, instead of being a no-op as it was before, it now busts the entire storybook (and does so when the storybook loads and not on each individual broken story).

The error message is also fairly hard to decipher. I'm not sure if this is something y'all want to address, but I'll leave this open just in case. Feel free to label with a wontfix!

@thani-sh
Copy link
Contributor

Hi @majapw
Thanks for reporting. I didn't realize actions are used without names. Released a fix for this on v1.1.3. It should work fine without action names again.

@evenchange4
Copy link
Contributor

Still get the problem with v1.1.3.
I think there are some reserved words of function names (fnName).

❌ Fail cases:

action('default');
action('1');  // (It will be parsed into Number type.)

✅ My workaround is to add some prefix:

action('kind: default');
action('index: 1');  // (Number)

@ndelangen
Copy link
Contributor

ndelangen commented Apr 5, 2017

Is there anything we need to follow up upon? Or can this be closed now?
Perhaps some improvement in documentation? @evenchange4

@evenchange4
Copy link
Contributor

evenchange4 commented Apr 6, 2017

Okay, documentation improvement is quite enough.
I create a PR #31 to add a note for this use case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants