addon-docs ArgsTable API requires 'control' prop to be present to have an overriding effect
See original GitHub issueDescribe the bug
In order to work around a separate vue-docgen-api issue with TS types in Vue not displaying verbose enough, I am trying to override the type
of my props in the ArgsTable by following these instructions:
https://storybook.js.org/docs/react/api/argtypes#manual-specification
and
https://storybook.js.org/docs/react/writing-docs/doc-blocks#customizing
However, the argTypes
objects that I have added to the MDX <Story>
do not override the Type in the props table unless I also add a control: { type: null }
prop to each prop object. It works correctly, updating/fixing/overriding the type, when I include that node, with the additional side-effect of adding an unwanted Controls column to my ArgsTable.
In an ArgsTable where I attempt to make more than one type correction, simply including the control: { type: null }
on one prop is enough to make all the other props adopt their corrected types.
While type
is my use case, I also noted that the description
field follows the same behavior – it too requires the control
node to be present to take an overriding effect.
Please see the Code Snippets area below to see two examples.
To Reproduce Steps to reproduce the behavior:
- Adjust the ArgTypes of a story/component by setting
table: { type: { summary: 'NewType' } }
- Observe that the type in the ArgTable is not changed to “NewType”
Expected behavior
The ArgsTable should use the overrides described in the argTypes
object without any other required properties on the argsTypes
node.
Code snippets The following example does not change the Type field in the ArgsTable
<Story name="ImageSlider"
argTypes={{
images: {
table: {
type: {
summary: 'ImageInterface[]'
}
}
},
...
</Story>
The following example does change the Type field in the ArgsTable, and adds an unwanted “Controls” column:
<Story name="ImageSlider"
argTypes={{
images: {
table: {
type: {
summary: 'ImageInterface[]'
}
},
control: {
type: null,
},
},
...
</Story>
System:
Environment Info:
System:
OS: macOS 10.15.6
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Binaries:
Node: 14.4.0 - /usr/local/bin/node
npm: 6.14.4 - /usr/local/bin/npm
Browsers:
Chrome: 85.0.4183.83
Firefox: 75.0
Safari: 13.1.2
npmPackages:
@storybook/addon-actions: >=6.0.21 => 6.0.21
@storybook/addon-docs: >=6.0.21 => 6.0.21
@storybook/addon-knobs: >=6.0.21 => 6.0.21
@storybook/addon-links: >=6.0.21 => 6.0.21
@storybook/addon-notes: ^5.3.21 => 5.3.21
@storybook/vue: >=6.0.21 => 6.0.21
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (3 by maintainers)
@sneyed Hmm that’s a bug. Will dig in
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!