-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Components: Remove PropsTable, clean ArgsTable stories #11105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stories look great a couple suggestions
{propsTableStories.normal()} | ||
{sourceStories.jsx()} | ||
</> | ||
<Description.Text {...Description.Text.args} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you should do the default parameter binding trick for these stories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default parameter binding trick doesn't seem to work. <Description.Text />
seems to fill in props with {}
, overriding the trick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I see what you mean, I guess react passes {}
by default not undefined
which breaks that pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So for react it's really Story.defaultProps = Story.args
method the only way?
I know that this is a beta version and this PR is marked with Thanks in advance. [edited] |
We try to document all breaking changes here: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-53x-to-60x This PR in particular is a breaking change because I removed a component from |
Thanks for the fast reply. From the docs and code, I don't get why we are not seeing our props in React components. We have one storybook for both React and Vue components, and we are doing these: import { extractArgTypes as reactExtractArgTypes } from '@storybook/addon-docs/dist/frameworks/react/extractArgTypes';
import { extractArgTypes as vueExtractArgTypes } from '@storybook/addon-docs/dist/frameworks/vue/extractArgTypes';
import { createElement } from 'react';
import toReact from '@egoist/vue-to-react';
export const parameters = {
docs: {
extractArgTypes(component) { // would be awesome to have access to context like we have in decorators 😉
if (typeof component === 'function') {
return reactExtractArgTypes(component);
}
return vueExtractArgTypes(component);
}
}
};
export const decorators = [
(storyFn, { kind }) => {
let story = storyFn();
const [framework] = kind.split('/');
switch (framework) {
case 'vue':
const Story = toReact(story);
story = createElement(Story, null);
break;
}
return story;
}
]; This have been working till Putting a module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-docgen-loader',
enforce: 'post',
options: {
docgenOptions: Object.assign(
{
alias: config.resolve.alias
},
options.vueDocgenOptions,
{
alias: resolve.alias
}
)
}
}
]
} in Again, thanks in advance |
First off, the way you are using Storybook is definitely not supported. We are releasing a new feature called composition in SB 6.0, that should allow you to mix frameworks more cleanly. That said, the big change in There's one open issue so far that might be related: #11146 And there's an open PR that attempts to fix it: #11184 Hope that helps! cc @hipstersmoothie |
Exploring a bit this issue, I also ended up in #11106 . Forcing the I will follow that PR. Thanks for the help, and continue with the awesome work 🙇 |
This stands out to me. I don' t think storybook should be using
If a user is using |
Thinking about this I should probably remove this check https://github.com/storybookjs/storybook/blob/next/app/react/src/server/framework-preset-react-docgen.ts#L9-L11 so that babel-docgen is always loaded. Since the default is @shilman @mrmckeb I feel like there should be some way to detect if we want the EDIT: but then there isn't a guarantee that there isn't a mix of JS and TS components... |
Hi @hipstersmoothie I think that is exactly the issue. And sorry to spam this PR 😊 |
It's kinda bad but I think
|
It might make more sense for @shilman thoughts? |
@hipstersmoothie we tried making react-docgen the default already (for performance reasons) but its typescript handling is just not good enough yet. I don’t understand the issue? Why can’t react-docgen-typescript ONLY apply to .ts/.tsx files? I think we had that setup working before with react-docgen-typescript-loader cc @mrmckeb |
The problem is this line which makes it so that 'babel-plugin-react-docgen' is only loaded when it is set to use that. This means that JS only users do not have 'babel-plugin-react-docgen' loaded because the default is I changed that line because I didn't want 2 docgen to run on my components: 1 by babel and 1 by the plugin. |
what about this line: doesn't it skip |
Totally missed that. You’re right! |
Great discussion guys. Just tried the new release ( |
Issue: N/A
What I did
This is pre-work for an ArgsTable redesign
How to test
CI is passing