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

vue3: Using components in decorators, does not render the components #14788

Closed
thomasaull opened this issue May 3, 2021 · 3 comments
Closed

Comments

@thomasaull
Copy link

Describe the bug
Using a decorator like this:

import MyButton from './Button.vue'

export default {
  title: "Example/Button",
  component: MyButton,

  decorators: [
    () => ({
      components: {
        MyButton,
      },

      template: `
        <MyButton label="Button from default decorator"/>
        <story/>
      `,
    }),
  ],
};

does not render the actual MyButton component, but this:

<mybutton label="Button from default decorator"></mybutton>

To Reproduce
https://github.com/thomasaull/storybook-vue3-decorator-bug
Reproduction repository is a default vue-cli and storybook install, I added the example code in this commit: thomasaull/storybook-vue3-decorator-bug@d3a8899

To reproduce, run npm run storybook and navigate to the Button component

System

Environment Info:

  System:
    OS: Linux 5.4 elementary OS 5.1.7 Hera
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    npm: 6.14.11 - ~/.nvm/versions/node/v14.16.0/bin/npm
  Browsers:
    Chrome: 89.0.4389.114
    Firefox: 85.0.1
  npmPackages:
    @storybook/addon-actions: ^6.2.9 => 6.2.9 
    @storybook/addon-essentials: ^6.2.9 => 6.2.9 
    @storybook/addon-links: ^6.2.9 => 6.2.9 
    @storybook/vue3: ^6.2.9 => 6.2.9 

Additional context
When comparing those two files:

It looks like, in the vue3 Integration the reference to the story.components is missing

@shilman
Copy link
Member

shilman commented May 4, 2021

@thomasaull any chance you can contribute a PR with the proposed fix from above and a simple repro in examples/vue-3-cli

@thomasaull
Copy link
Author

@shilman Yes, I just did that: #14809

@shilman
Copy link
Member

shilman commented May 6, 2021

Zoinks!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-alpha.20 containing PR #14809 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed May 6, 2021
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

2 participants