-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Addon-controls/Vue3: Control update while using decorators causes component to unmount/remount #21235
Comments
@chakAs3 is this something you can look into when you have time? |
Yes sure I will be on it . |
I guess I already fixed it in the csf2 tests PR, as I encountered while creating these tests : : : : : |
Seems like this happens when you create a fresh vue3 project with storybook. Add console.log in setup and you see that it popus on every prop change. I used Button -> Secondary as an example. Used these dependencies
|
hi @thomasaull i just looked at your dependencies, you have actually to use v7. as my PR is target the new RC and not the old version |
@thomasaull i'm sorry yes intent @Ballpin |
Ahh. Ok so the bug is fixed in v7? Thanks for rhe answer. |
yes @Ballpin welcome, please try to upgrade your storybook to 7. check that let me know if it is fine for you. or use this repo https://github.com/storybookjs/vue3-vuetify-examples, has many examples with decorators, you can test faster and this has the latest patch for @storybook/vue3 with 1 PR not yet merged |
Boo-yah!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.1.0-alpha.7 containing PR #21954 that references this issue. Upgrade today to the
|
Describe the bug
When toggling a control value, the component unmounts and then remounts, preventing internal component state from being persisted. This prevents things like transitions and animations from being possible to represent via the controls.
To Reproduce
https://github.com/treardon17/storybook-decorator-bug
System
Additional context
This issue is very similar to #13913, but a slight variation. Everything works fine when not using decorators (ie. the vue component mounts once and does not unmount when changing the args via the controls), but as soon as a decorator is added the components are now mounted/unmounted continuously when changing args via the controls.
Toggling this line on/off will demonstrate the behavior. https://github.com/treardon17/storybook-decorator-bug/blob/bd117642e0cb586a1d9d79966f76da22e83367de/.storybook/preview.ts#L28
Only mounting the component once allows for tests that watch props or deal with animations that require state, and using decorators allows for libraries like Vuetify to be able to inject a theme to the child components, so ideally both would work.
The text was updated successfully, but these errors were encountered: