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

Standalone preview does not support addon-actions #8677

Closed
rpggio opened this issue Nov 2, 2019 · 8 comments
Closed

Standalone preview does not support addon-actions #8677

rpggio opened this issue Nov 2, 2019 · 8 comments

Comments

@rpggio
Copy link

rpggio commented Nov 2, 2019

Describe the bug
addon-actions does not work with the standalone approach in https://github.com/storybookjs/storybook/tree/next/examples/standalone-preview due to cross-frame constraints.
In addition, even without addon-actions, there are click listener warnings in console that suggest other things may be broken.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a story using addon-actions
  2. Click on a button that triggers an action
  3. See error in console
  4. See no action message logged

Expected behavior
Message logged in action pane.

System:

System:
OS: macOS Mojave 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 8.16.1 - ~/.nvm/versions/node/v8.16.1/bin/node
Yarn: 1.19.1 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.16.1/bin/npm
Browsers:
Chrome: 78.0.3904.70
Safari: 13.0.3
npmPackages:
@storybook/addon-console: ^1.2.1 => 1.2.1
@storybook/addon-knobs: ^5.2.5 => 5.2.5
@storybook/addon-notes: ^5.2.5 => 5.2.5
@storybook/react: ^5.2.5 => 5.2.5

Additional context
Using parcel for standalone build.

@shilman
Copy link
Member

shilman commented Nov 3, 2019

cc @RPDeshaies would you mind taking a look at this?

@RPDeshaies
Copy link

I can have a look when I have some free time this week. I'm using parcel and the actions add-ons in a project and I have no issues on my end. If you have a repo to reproduce the issue that could help me a lot.

@rpggio
Copy link
Author

rpggio commented Nov 4, 2019

Hi @RPDeshaies , repro at https://github.com/ryascl/storybook-standalone-preview .
Thanks!

image

Blocked a frame with origin "http://localhost:1337" from accessing a cross-origin frame.
at JSON.stringify ()
at stringify (http://localhost:1337/stories.ec0275ef.js:48220:15)
at PostmsgTransport.send (http://localhost:1337/stories.ec0275ef.js:48413:42)
at handler (http://localhost:1337/stories.ec0275ef.js:6815:28)
at Channel.emit (http://localhost:1337/stories.ec0275ef.js:6825:9)
at actionHandler (http://localhost:1337/stories.ec0275ef.js:50131:13)
at HTMLUnknownElement.callCallback (http://localhost:1337/stories.ec0275ef.js:19019:18)
at Object.invokeGuardedCallbackDev (http://localhost:1337/stories.ec0275ef.js:19068:20)
at invokeGuardedCallback (http://localhost:1337/stories.ec0275ef.js:19121:35)
at invokeGuardedCallbackAndCatchFirstError

@RPDeshaies
Copy link

Alright so, I was able to reproduce the issue with your repo (thank you).

Though I have no idea why it fails it seems to be related to the initial render of the component having a onClick even that comes directly from the return function of an action addon.

The reason why I say this, is because I was able to find a "temporary-fix" where I just used a anonymous function that calls the action

 storiesOf("Button", module).add("Button w/action", () => (
    <button
      onClick={() => {
        console.log("oh hello");
        action("onCheckinLinkClicked")(1,2,3);
      }}
    >
      Engage
    </button>
  ));

image

P.S. Your repo is using "@storybook/react": "5.3.0-alpha.36", which is different than the version you mentionned in the github Issue. Just an FYI.

@shilman any ideas why an initial react render using an onClick event that comes from the return value of the action addon would cause that kind of errors ?

@shilman
Copy link
Member

shilman commented Nov 26, 2019

No idea. Forwarding to @ndelangen

@stale
Copy link

stale bot commented Dec 17, 2019

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!

@stale stale bot added the inactive label Dec 17, 2019
@stale
Copy link

stale bot commented Jan 16, 2020

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Jan 16, 2020
@vasileermicioi
Copy link

@ryascl thanks for reproduction, I was also interested in the topic (to get rid of webpack but to use storybook) and it led me to this solution / workaround https://github.com/vasileermicioi/parcel-storybook

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