-
Notifications
You must be signed in to change notification settings - Fork 46
forwardRef trips up docgen #76
Comments
Mirror issue on Storybook side: storybookjs/storybook#8881 |
Relevant issue in react-docgen: reactjs/react-docgen#267 |
This might be fixed with react-docgen 5.0.0-beta.1 which includes a pull request that is titled "Fully support forwardRef": reactjs/react-docgen#350 |
@jonathanherdt i ran into this issue as well. I dont think the react-docgen issue is related since this loader uses something else under the hood. I was able to get the docgenInfo object to show up by destructuring // bad
import React from 'react';
export const MyComponent = React.forwardRef<A, B>( ... )
// good
import React, { forwardRef } from 'react';
export const MyComponent = forwardRef<A, B>( ... )
` |
This is not working for me, event with destructuring. Getting the cannot read property ... of undefined. I'm on version Can confirm that taking the forwardRef out displays all props correctly.
|
@jeffcstock have you tried parameterizing your forwardRef invocation? i.e. |
@awinograd thanks for your response, but yes I can confirm that doesn't help things. Same exact result. 😕 |
@jeffcstock no problem. sorry i wasn't more help! |
@jeffcstock Storybook 5.3 was just released and fixes this for me. Maybe give it a shot? |
That fixed it, thank you @jonathanherdt! |
Closing this issue because of multiple reports that it's been resolved. Leave a message if it's still a problem. |
Describe the bug
When implementing a Component in the way described below, the Storybook Props block (created via
react-docgen-typescript-loader
) only shows the following text:"Cannot read property 'appearance' of undefined"
To Reproduce
Declare a component in way mentioned under "Code snippets".
Expected behavior
The Props block should display the corresponding Props.
Screenshots
Code snippets
Button.tsx
Button.stories.tsx
System:
package.json
Update: Also tested with 3.6.0.
Tried out with both Storybook 5.2.5 and Storybook 5.3.0-beta.1
Using stories in the TSX file format but encountered the error also when using the JSX file format.
Component is in TSX format.
Please paste the results of
npx -p @storybook/cli@next sb info
here.Additional context
Used to work before introducing
RefForwardingComponent
andReact.forwardRef
The text was updated successfully, but these errors were encountered: