GithubHelp home page GithubHelp logo

storybook-eol / storybook-addon-actions Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 8.0 165 KB

REPO/PACKAGE MOVED - Action logger addon for storybook

Home Page: https://github.com/storybooks/storybook/tree/master/addons/actions

JavaScript 100.00%

storybook-addon-actions's People

Contributors

arunoda avatar davidmason avatar evenchange4 avatar gnarf avatar greenkeeperio-bot avatar ndelangen avatar raciat avatar shilman avatar thani-sh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

storybook-addon-actions's Issues

v1.1.2 breaking change

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.

Warning: Accessing PropTypes via the main React package is deprecated

When we upgraded React, we started getting the following in our tests:
Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead. I tracked some of them down to this package.

It looks like at least the ActionLogger accesses PropTypes with React.PropTypes

logging objects with circular references

Issue / how to reproduce:
When a component calls an action handler with an object in the args that has circular references (in my case, that was a Proxy), you see no action logged. But you will see an error in the actual JavaScript console: Uncaught TypeError: Converting circular structure to JSON

Some investigation:
I could try/catch the error around the emit() call in preview.js.

Ideas:
I am not sure how to resolve this actually. The action logger could still show the name of the invoked action and the property names on the root level of the object or something like that. Or the emit function could get support for circular structures, or the communication done otherwise, or the structure resolved to a non-circular one (which might be a bit trickier if there is not already a module for that).

decorateAction not working as expected

So currently, if I do args => args.splice(0, 1) still I will get an array. How can I just log the first element of that array ?

if I do

const firstArg = decorateAction([
  args => args[0]
]);

In simpler terms how do I log firstTerm instead of [firstTerm] if my args was [firstTerm, secondTerm, thirdTerm]

Circular json can possibly hang.

It can be replicated by replacing circular with something like window within:

https://github.com/kadirahq/storybook-addon-actions/blob/master/.storybook/stories.js#L20

The click on the circular button will cause the action to never be logged.

I've tried replacing json-stringify-safe with circular-json which seems to behave better.
But even then after the 4th click circular-json will throw a circular reference error.

I now know how to circumvent this by just not logging something with circular references, however when this bug is encountered it's not immediately clear the hang originates from within storybook which makes one try to debug the application code itself first.

I think replacing json-stringify-safe with circular-json would already be an improvement.

Passing event.target causes Storybook to hang

I have a story that passes onFocus={action('Focused')}
The component is an input element with onFocus={this.onFocus}

onFocus = e => {
  this.props.onFocus && this.props.onFocus(e.target);  // App hangs.  'e' alone is fine.
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.