-
-
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
Using \ in React display name cause SB js Uncaught SyntaxError: Invalid or unexpected token #12328
Comments
Do you have a repro repo you can share? Possibly related: #11419 |
Hey @flessard, thanks for opening this issue. I assume you're using that displayName in order to have the component hierarchy separators in the storybook menu, is that right? If so, the way it's done in your repro repo is incorrect. You should do so in the If you really want to set a display name for that component, it's fine, but special characters such as If you change from it should work without issues. |
Here's what I mean: Remove the displayName from the component: // Button.tsx
- Button.displayName = 'UI/Button'; Add that to your stories file // Button.stories.tsx
export default {
- title: 'Example/Button',
+ title: 'UI/Button',
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
} as Meta; Does that make sense? If not let me know and I'll do some investigation about it! :) |
@yannbf no, I don't use the displayName for naming my story, I use it for my internal tool :) |
Thanks for explaining @flessard! I've done some investigation and added my findings in the |
@yannbf any update about this bug ? Thanks :) |
Hi @yannbf, do you think we can fix with https://www.npmjs.com/package/patch-package ? |
Yes, if we do have a fix for it. You could maybe extend the research I started and come up with a proposal? Then we could help along the way! |
@yannbf the repo has been archived. I think no fix will be released for this bug. |
It looks like we need to move the bit of code I used from the loader into the plugin. @yannbf If you want to take a stab at it you'll get a test version of the code when you open a PR. Happy to help how I can. |
Any update ? |
@hipstersmoothie, @yannbf or @shamin any update about this bug ? Thanks. |
@shilman any updates?( I have same issue |
Hey @flessard @inomdzhon thanks for checking up. This issue is bigger than me, I did some investigation but I think the best candidate to fix it is @hipstersmoothie. @hipstersmoothie sorry I missed your message, but I don't have 100% context to take a stab at the fix and currently I'm quite busy :( |
Using \ in React display name cause SB js Uncaught SyntaxError: Invalid or unexpected token
To Reproduce
Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: