Skip to content

Conversation

@Dschungelabenteuer
Copy link
Member

@Dschungelabenteuer Dschungelabenteuer commented Mar 13, 2021

Issue: #9695

As of pull request #9699, it is possible to provide addon-docs a vueDocGenOptions parameter, which is supposed to fix issue #9695. Unfortunately, as stated in the issue, this is not working properly. @pocka started debugging and noticed that options.vueDocgenOptions returns undefined. I went a little bit further by browsing the whole options object to find any occurrence of my custom configuration defined in Storybook's main.js file.

I found it within the options.presetsList array. Please note there are actually two presets related to addon-blocks:

[
  ...otherPresets,
  {
    name: 'project\node_modules\@storybook\addon-docs\dist\frameworks\common\preset.js',
    options: {
      vueDocgenOptions: {
        /** My custom vue-docgen-api configuration is found here. */
      }
    },
    preset: {},
  },
  {
    name: 'project\node_modules\@storybook\addon-docs\dist\frameworks\vue\preset.js',
    options: {},
    preset: {},
  },
],

What I did

I basically defined an option object for vue-docgen-api and merged all preset options matching adddon-docs and containing a vueDocgenOptions key into this object. The option object is then passed to vue-docgen-loader's options.docgenOptions.

There is likely a better and cleaner way to fix it, but this is all I came up with given my relatively poor knowledge regarding storybook addons configuration.

How to test

  • Is this testable with Jest or Chromatic screenshots? no
  • Does this need a new example in the kitchen sink apps? no
  • Does this need an update to the documentation? no

@Dschungelabenteuer Dschungelabenteuer marked this pull request as ready for review March 13, 2021 15:40
@shilman shilman requested a review from pocka March 14, 2021 00:29
Copy link
Contributor

@pocka pocka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically looks good to me 👍

Commented for-Storybook-developer things.

@pocka
Copy link
Contributor

pocka commented Mar 17, 2021

@shilman
Should I merge this PR as a temporary workaround or wait for the fix in Storybook core?

@shilman
Copy link
Member

shilman commented Mar 17, 2021

thanks @pocka ... checking with @ndelangen to figure out the best path

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, finally understand what's happening here .. thanks @ndelangen for clarifying. Let's merge for now and then re-address this once we refactor the ArgType extraction in (hopefully) 7.0

@shilman shilman changed the title Applying preset options for vue-docgen-api (extending PR #9699) Addon-docs/Vue,Vue3: Fix preset options for vue-docgen-api Mar 17, 2021
@shilman shilman merged commit 40a57a4 into storybookjs:next Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants