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

Story canvas isn't updated on Controls prop change for Vue components #17605

Closed
thalesagapito opened this issue Mar 2, 2022 · 4 comments
Closed

Comments

@thalesagapito
Copy link

thalesagapito commented Mar 2, 2022

Describe the bug
The story canvas isn't updated when I change prop values in the Controls tab. However, when refreshing the page the props are loaded correctly. Also, the docs page updates the component like it should.

To Reproduce
https://github.com/thalesagapito/sb-repro

Hosted at
https://621ee2f9beff3f003ac5bd73-nqmnedayec.chromatic.com/?path=/story/atoms-vpillbox--base

System
Environment Info:

System:
OS: macOS 11.5.2
CPU: (8) x64 Apple M1
Binaries:
Node: 14.18.1 - /usr/local/bin/node
Yarn: 3.2.0 - ~/.yarn/bin/yarn
npm: 6.14.15 - /usr/local/bin/npm
Browsers:
Chrome: 98.0.4758.109
Firefox: 96.0.3
npmPackages:
@storybook/addon-actions: ^6.5.0-alpha.45 => 6.5.0-alpha.45
@storybook/addon-docs: ^6.5.0-alpha.45 => 6.5.0-alpha.45
@storybook/addon-essentials: ^6.5.0-alpha.45 => 6.5.0-alpha.45
@storybook/addon-links: ^6.5.0-alpha.45 => 6.5.0-alpha.45
@storybook/builder-webpack5: ^6.5.0-alpha.45 => 6.5.0-alpha.45
@storybook/manager-webpack5: ^6.5.0-alpha.45 => 6.5.0-alpha.45
@storybook/vue: ^6.5.0-alpha.45 => 6.5.0-alpha.45

Additional context
This was reported before at #11051

@thalesagapito thalesagapito changed the title [addon-controls] Story canvas isn't updated on Controls prop change for Vue component Story canvas isn't updated on Controls prop change for Vue component Mar 2, 2022
@thalesagapito thalesagapito changed the title Story canvas isn't updated on Controls prop change for Vue component Story canvas isn't updated on Controls prop change for Vue components Mar 2, 2022
@Sidnioulz
Copy link
Contributor

Confirming this bug for Vue 2.6 / SB 6.4, and for Vue 2.7 / SB 7.0-alpha37.

On the alpha branch, because docs now use the canvas mode renderer, the bug has propagated to the docs page too.

@Sidnioulz
Copy link
Contributor

Duplicate of #16750

@thalesagapito
Copy link
Author

Not sure if this is going to help anybody, but I finally got this to work. The issue was that I was destructuring the args of the render function (and probably losing reactivity). I went from this:

export const Sandbox: Story = {
  render: ({ ['default']: defaultSlot, ...args }) => ({
      setup: () => ({ args, defaultSlot }),

to this:

export const Sandbox: Story = {
  render: args => ({
    setup: () => ({ args, defaultSlot: args.default }),

And now it works fine.

@shilman
Copy link
Member

shilman commented Dec 25, 2023

closing as dupe to #16750

@shilman shilman closed this as completed Dec 25, 2023
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

3 participants