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

Force rerender with storybook/html #6623

Closed
hsablonniere opened this issue Apr 25, 2019 · 4 comments
Closed

Force rerender with storybook/html #6623

hsablonniere opened this issue Apr 25, 2019 · 4 comments

Comments

@hsablonniere
Copy link

Hey wonderful team of storybook 😄

I'm trying to force rerender my stories when a knob is changed with storybook/html but it does nothing when story is an HTML element.

I looked at the code, knob changes trigger a rerender so it should be OK but when the code execution arrives in renderMain if it sees forceRender === true it does nothing 😢

I'm probably missing the point here but reading this, I expected a force render to clear rootElement and reattach the node. The opposite of what it does right know.

https://github.com/storybooks/storybook/blob/master/app/html/src/client/preview/render.js#L20-L25

  • Can someone tell me more about this? @Atekon
  • Maybe I'm the only one expecting this since I use custom elements and a detach/reattach would trigger a rerender of my component.
@JohnMunsch
Copy link

I think I'm seeing the same thing when my object knob supplies new data to create a Redux model and assigns that to my LitElement component. I can see it go through the story, create a new model, create a new component, assign the model to the component, and then return the component. However, the rendered component shown in Storybook is still the previous one.

@Hypnosphi
Copy link
Member

Hypnosphi commented May 5, 2019

@igor-dv @Atekon looks like #4822 broke knobs for "HTML element" stories

One idea is to use reference comparison rootElement.firstChild === element instead of forceRender === true

@stale
Copy link

stale bot commented May 26, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label May 26, 2019
@hsablonniere
Copy link
Author

Thanks very much!!! 🎉

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

No branches or pull requests

4 participants