wingsuit-designsystem / wingsuit

Twig for Storybook
GNU General Public License v2.0
93 stars 16 forks source link

Reload javascript when changing a setting/field(knob) #91

Closed iuscare closed 3 years ago

iuscare commented 3 years ago

Is your feature request related to a problem? Please describe. When playing with knobs it is sometimes necessary to reinitialize a script. For example I have a button with two states and a select box (default and animated). When selecting the animated property, my button.behaviour.js is not being applied to the button element. Instead I have to reload the page, because I initialize my button class at the end within the button.behaviour.js file.

Describe the solution you'd like I might oversee something obvious. I would like a solution, where I can reinitialize a necessary script, if not already possible.

Describe alternatives you've considered Up to now I switched to different variants, causing different stories. When selecting another story, I get a full page reload and the script is initialized in a correct way

Kind Regards!

christianwiedemann commented 3 years ago

Right now Javascript is implemented as storybook decorator. This fires only if the story is changed. It would be better to fire it after the react render component is updated. Will check that

christianwiedemann commented 3 years ago

Javascript is attached after every render now. Much better this way. (beta30). Just run yarn upgrade. I added console deprecation infos for the decorator. So will close this for. Feel free to reopen if you have any issues.