Skip to content
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

[Bug]: Code of React components showing as <forwardRef> #22287

Closed
felipefialho opened this issue Apr 27, 2023 · 10 comments · Fixed by #26592
Closed

[Bug]: Code of React components showing as <forwardRef> #22287

felipefialho opened this issue Apr 27, 2023 · 10 comments · Fixed by #26592

Comments

@felipefialho
Copy link

felipefialho commented Apr 27, 2023

Describe the bug

I'm using the generated React components of Stencil Output React inside a Storybook instance running with React, everything works perfectly but when I click to check the component code it appears as follows:

<forwardRef>
  Button
</forwardRef>

The correct view should be:

<MyButton>
  Button
</MyButton>

I haven't found anything that could help me with this, especially since these wrappers are automatically generated by the Stencil and I have no way of modifying the output.

Can anyone help me?

To Reproduce

No response

System

Environment Info:
  System:
    OS: macOS 13.2.1
    CPU: (8) x64 Apple M1 Pro
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
    Firefox: 109.0.1
    Safari: 16.3
  npmPackages:
    @storybook/addon-a11y: ^7.0.1 => 7.0.2 
    @storybook/addon-docs: ^7.0.1 => 7.0.7 
    @storybook/addon-essentials: ^7.0.1 => 7.0.7 
    @storybook/addon-mdx-gfm: ^7.0.2 => 7.0.2 
    @storybook/addons: ^7.0.1 => 7.0.2
    @storybook/preset-typescript: ^3.0.0 => 3.0.0 
    @storybook/react: ^7.0.7 => 7.0.7 
    @storybook/react-webpack5: ^7.0.1 => 7.0.7 
    @storybook/theming: ^7.0.1 => 7.0.2

Additional context

image

@tassioFront
Copy link

I got the same

@Prasad-mutnale
Copy link

@felipefialho I want to work on this issue. i can solve this issue please assign me.

@binomialstew
Copy link

You might be able to get the component name to display correctly in the story source by setting Component.displayName in the story.

@yannbf yannbf moved this to In review in Storybook 8.0 Roadmap Mar 21, 2024
@yannbf yannbf moved this from Empathy Backlog to In Progress in Core Team Projects Mar 21, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in Storybook 8.0 Roadmap Mar 21, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Core Team Projects Mar 21, 2024
@yannbf
Copy link
Member

yannbf commented Mar 21, 2024

Hey @felipefialho thanks for reporting the issue. It will be fixed in the next patch release of Storybook 8!

Antes tarde do que nunca 🤞!

@plemesle
Copy link

storybook 8.3.2 is out, and issue is still here right ?

@yannbf
Copy link
Member

yannbf commented Oct 31, 2024

@plemesle the fix for this issue was released back in Storybook 8.0.4 #26592
please share a reproduction if you are still experiencing the issue, we can take a look then, perhaps it's a slightly different scenario!

@mdedwards09
Copy link

mdedwards09 commented Nov 6, 2024

I'm on storybook version 8.3.6. In our case, we are using a component imported directly from MUI in our stories. If we wrap the component and use the wrapped one in storybook, we see what we are looking for, otherwise we see <React.ForwardedRef...

our implementation is basically this:

import { Button } from '@mui/material';
...
export const SingleButton: Story = {
  render: (args) => <Button {...args}>Single Button</Button>,
};

Our code snippet looks like so:

<React.ForwardRef
  endIcon=""
  size="medium"
  startIcon=""
  variant="contained"
>
  Single Button
</React.ForwardRef>

@JBassx
Copy link

JBassx commented Nov 8, 2024

Issue is still here!

@VietNguyenQuoc
Copy link

Please reopen as the issue still exists in 8.4.7

@Syden10
Copy link

Syden10 commented Jan 21, 2025

@yannbf could you please reopen this?

Issue is still present on latest, exact same scenario described by @mdedwards09
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.