You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When forwarding a ref to a child component, the component shows up as <Unknown>. You can set the display name of the wrapper component to the name of the child component, but this means less legible devtools.
To Reproduce
Steps to reproduce the behavior:
Export a component with a React.forwardRef wrapper:
View the story source section of addon-info
Note: If you set the displayName of the wrapper component, addon-info will use that. However, simply using the displayName from the child makes for less readable dev tools, it looks like component nested within itself.
Expected behavior
Story source should ignore the wrapper component <ForwardRef> and display the child before displaying <Unknown>
<ForwardRef(Component)> - good for dev tools bad for story
importReact,{forwardRef}from'react';constwithForwardRef=Component=>{constforwarder=forwardRef((props,ref)=>(<Component{...props}innerRef={ref}/>));forwarder.displayName=`ForwardRef(${Component.displayName||Component.name})`;// use display name if providedreturnforwarder;};exportdefaultwithForwardRef;
<Component> (duplicate child) good for story, bad for dev tools
importReact,{forwardRef}from'react';constwithForwardRef=Component=>{constforwarder=forwardRef((props,ref)=>(<Component{...props}innerRef={ref}/>));forwarder.displayName=Component.displayName||Component.name;// use display name if providedreturnforwarder;};exportdefaultwithForwardRef;
The text was updated successfully, but these errors were encountered:
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!
Describe the bug
When forwarding a ref to a child component, the component shows up as
<Unknown>
. You can set the display name of the wrapper component to the name of the child component, but this means less legible devtools.To Reproduce
Steps to reproduce the behavior:
Note: If you set the displayName of the wrapper component, addon-info will use that. However, simply using the displayName from the child makes for less readable dev tools, it looks like component nested within itself.
Expected behavior
Story source should ignore the wrapper component
<ForwardRef>
and display the child before displaying<Unknown>
Code snippets
<Unknown>
- currently happening w/o intervention<ForwardRef(Component)>
- good for dev tools bad for story<Component>
(duplicate child) good for story, bad for dev toolsThe text was updated successfully, but these errors were encountered: