-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
No decorators in storyshots #1849
No decorators in storyshots #1849
Conversation
cc @coreylight |
Thanks @usulpro! |
} | ||
} | ||
> | ||
Array [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is NOT what we want to happen. Part of the actual story is gone from the snapshot!
Should we keep a list of all the decorators and only filter out those components? We should also not just remove the first parent, but we'd have to recursively remove/filter them from top, since decorators could be wrapped (multiple decorators around 1 story). |
@ndelangen I like those suggestions. I'm not very familiar with the codebase so I fully expected some iteration on this 😊 |
I'm gonna close this PR since there hasn't been much activity here. Feel free to reopen or leave a comment here so we can reopen it for you. |
I'm still very keen on not seeing decorators in the storyshot as I use enzyme shallow so the storyshot becomes quite useless and it doesn't show the component in question :) |
In the meantime my plan is to use enzyme shallow |
@axelnormand agreed Join us on slack and we'll collaborate and make it happen, I think @Hypnosphi would love this as well! |
Guys, is there any resolution to this issue? @ndelangen @axelnormand I am having same issue: i have my decorators in all the storyshots. I was using I found the issue #1620, which is closed for being obsolete with no resolution. |
Alas i didn't have time (yet) to contribute anything to the storybook project which might help this. What i ended up doing was mocking the
|
That's an interesting solution @axelnormand. In 5.0.0 I added new api's for storyshots to be able to ACCESS the original storyFn and a fully decorated Fn. It's currently using the fully decorated Fn always, but it could fairly easily start rendering the raw one based on an option/parameter. I think that's really the way forward, since some people will WANT the decorators and some DON'T. And quite possibly it might be different per story! |
I might take a crack at it. |
oh didnt know that about the new 5 API, great stuff. Thanks @ndelangen |
@axelnormand we cleanup up A LOT of internals, making us better able to make changes like this. On top of that the |
Gonna open a PR in a few minutes adding this feature! |
@axelnormand very great workaround. However, I have some decorators that are adding Context Providers to the stories... Without it, stories don't consume correctly the data... So I need to mock also all these Context...? 😯 Or maybe there is a better way to add these Context Providers than using decorators? |
Issue:
What I did
How to test
Is this testable with jest or storyshots?
Does this need a new example in the kitchen sink apps?
Does this need an update to the documentation?
If your answer is yes to any of these, please make sure to include it in your PR.