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

Bug: preview hooks inside a decorator thrown an error #50

Open
lgraziani2712 opened this issue Aug 28, 2020 · 6 comments
Open

Bug: preview hooks inside a decorator thrown an error #50

lgraziani2712 opened this issue Aug 28, 2020 · 6 comments

Comments

@lgraziani2712
Copy link

When I'm trying to meassure the performance of a story with decorators with preview hooks, the renders throws an error:

Storybook preview hooks can only be called inside decorators and story functions

image

If I remove the decorator's preview hooks, everything works correctly.

Than you for your work!

@markelarizaga
Copy link

I'm experiencing the same.
@lgraziani2712 maybe you want to update the title of this issue to make it more descriptive, I clicked on it to check if by any chance was the same thing I'm reproducing, and it was!
However maybe other people just ignore the issue if it just says "Bug".

@lgraziani2712 lgraziani2712 changed the title Bug: Bug: preview hooks inside a decorator thrown an error Dec 9, 2020
@lgraziani2712
Copy link
Author

Thank you for noticing this, @markelarizaga! I was pretty sure I did write a descriptive title, but wasn't the case!

It is now fixed :)

@SatorCube
Copy link

SatorCube commented Mar 29, 2021

Can confirm the same issue. It also happens when you the performance addon in conjunction with the popular pseudo-states addon. As of right now, they are mutually exclusive because of this bug. :"(

@iyobo
Copy link

iyobo commented Feb 15, 2022

Same issue when used in conjunction with storybook-miragejs.

Sadly, the only way to use this addon is to make sure other decorators that come before it in the chain do not use storybook hooks e.g useChannel, useParams, etc. Using React hooks are fine.

Was able to work-around by recreating the storybook-miragejs addon functionality I needed from scratch using purely react hooks. Nonetheless, this issue is very limiting for most realistic storybook implementations.

@viktor-panasiuk-97
Copy link

The issue is still relevant. In case you use preview hooks, the package does not work -
image

@trouba
Copy link

trouba commented Jul 23, 2024

This issue is still relevant, I've got the same error when using useArgs in a story

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

No branches or pull requests

6 participants