-
-
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
[Addon-docs] ForwardRef has props === undefined during exractProps #8894
Comments
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! |
Repro: 822f3df |
Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.0-alpha.21 containing PR #12686 that references this issue. Upgrade today to try it out! You can find this prerelease on the |
Describe the bug
ForwardRef components receive
undefined
asprops
duringexractProps
step.https://github.com/storybookjs/storybook/blob/next/addons/docs/src/frameworks/react/extractProps.ts#L28-L31
Check out code snippets [1], [2]
Both are actually incorrect, since in React runtime you always have the
props
object presented, it just doesn't have any keys on it if no props were passed.To Reproduce
If you change
examples/official-storybook/components/ForwardedRefButton.js
to have a destructuring on props, the props extraction process will fail, e.g. [3]And then check the story examples/official-storybook/stories/addon-docs/props.stories.mdx.
There would be no props available for the component.
Expected behavior
Props table is shown
Code snippets
[1]:
[2]:
[3]:
System:
Replicated in latest storybook repo's examples, but originally found in @storybook/[email protected].
Additional context
Here is a downgrade commit in our repo that fixed the behaviour: nordnet/ui@6cf7ee5.
The component that failed was https://github.com/nordnet/ui/tree/master/src/Atoms/Box
The text was updated successfully, but these errors were encountered: