atlassian-labs/storybook-addon-performance

Bug: preview hooks inside a decorator thrown an error

lgraziani2712 opened this issue ยท 6 comments

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!

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".

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 :)

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 commented

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.

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

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