Storybook: Force rerender with storybook/html

Created on 25 Apr 2019  路  4Comments  路  Source: storybookjs/storybook

Hey wonderful team of storybook :smile:

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

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.
html inactive question / support

Most helpful comment

@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

All 4 comments

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.

@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

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!

Thanks very much!!! :tada:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MrOrz picture MrOrz  路  3Comments

shilman picture shilman  路  3Comments

ZigGreen picture ZigGreen  路  3Comments

dnlsandiego picture dnlsandiego  路  3Comments

zvictor picture zvictor  路  3Comments