Storybook: Knobs/Controls add-ons fail to update UI when using Zero config typescript

Created on 10 Jul 2020  路  12Comments  路  Source: storybookjs/storybook

Describe the bug
Using zero config typescript the addons knobs and controls do not update the ui one the value is changed in the control.
I'm using web components.

To Reproduce
Steps to reproduce the behavior:

  1. Start storybook with zero config typescript
  2. Open a story with controls or knobs
  3. change the value of the control
  4. UI keeps the same with the default value.

Expected behavior
The UI is updated

Additional context
I'm working with web components, haven't tried with react.

P1 controls knobs web-components bug todo tracked typescript

All 12 comments

My project https://github.com/fernandopasik/hello-web-components has a custom config for typescript that works good. And I have a branch in the repo https://github.com/fernandopasik/hello-web-components/tree/ts-zero-config where the bug can be reproduced.

I'm a bit lost on why this issue could be happening, any clue @shilman ?

I don't know what's going on.

  1. I verified that this works on the main branch, then switched to the zero-config branch
  2. I upgraded to the latest RC using npx sb@next upgrade --prerelease
  3. I added a console.log to the story

I observed that:

  1. The story function is getting called repeatedly with the expected args as I type, but the preview is not refreshing
  2. The story is refreshing as expected in the Docs tab

I don't know how this is related to the config change. 馃

Great finding about the docs tab, I didn't notice. In that case all of it is in the same iframe.

Canvas has the controls outside the iframe.

Also, the value is modified in the component, what seems to happen is that the update is not triggered within the component.
I've triggered manually the update with dev tools selecting the element and running in the console $0.update()

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!

@fernandopasik is this still an issue for you? I don't see that branch any more in your repo--could you recreate it possibly?

Hi @tmeasday! Yes I've just updated my repo to latest storybook and checked that still an issue.

https://github.com/fernandopasik/hello-web-components

If you run yarn start on that one storybook will start. The problem it's noticed in the canvas view as you change the control value it doesn't update the UI. If you go to the docs view it updates correctly.

Yep, I see. Let me investigate.

@fernandopasik I don't really know much about web-components or lit-element but what I can see in the browser is that the element is getting updated:

Screen Recording 2020-11-09 at 4 48 26 pm

From my perspective (the controls/args implementation) we are doing the right thing, but there could be a bug in @storybook/web-components, for sure. I suspect you have a better chance of diagnosing it than me though! Any ideas?

Yes, I noticed the same thing.

I used before a custom webpack configuration adding ts-loader to it and that worked fine, that was the oddest part.

https://github.com/fernandopasik/hello-web-components/commit/c99b8db052a5f6efc2c6428d4a027e992f9302d0#diff-2d9ab5214985b9a608b4cd47ed561a301cfd4c7d5352c7a94ee046d4e1f1af10

I guess it is difficult for me to debug further as I am no expert on WCs. Do you have an idea on how to understand why a WC would not re-render when an attribute changes?

Was this page helpful?
0 / 5 - 0 ratings