-
Notifications
You must be signed in to change notification settings - Fork 29
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] name2.replace is not a function #99
[Bug] name2.replace is not a function #99
Comments
I had really hard time chasing it down, and narrowing the code. I'm sorry to not be able to provide more precise information 😕 |
Same happening here, it happens when an instance of a class is passed to the To reproduce it, I had to edit the component code while displaying that same component from Storybook in the browser. |
This breaks Storybook on every hot-reload and makes development unworkable after updating to Storybook v7.1.0. |
@BenjaminVanRyseghem just building on what you found Here is the source file / LN where the issue occurs: Line 347 in be8180e
|
as a workaround, I locally replaced this line with let name = name2.replace ? name2.replace(/[^a-zA-Z0-9$_]+/g, "") : "DefaultConstructorName"
const Fn = new Function(`return function ${name}(){}`)(); and so far it seems to work 😄 |
yea I was going to look at how to patch it locally at least to prevent Storybook from crashing - I will use your suggestion as an interim solution. @ndelangen any idea on what it would take to get a fix in to patch Storybook? can we submit a PR or is this something you have an easy solution for? |
I'll try and fix this today! |
I found a fix in storybook, I'll open a PR, and try to get this merged/patch asap. |
I still get the |
@TheSlimvReal I fixed the problem in storybook, can you make sure you're using If you could supply a reproduction repo, that would allow to me investigate. |
The issue was fixed for me in v7.2.0, maybe try pinning to that specific version and make sure all Storybook dependencies in your If it still breaks in the newest version, there might have been a regression. |
I'm on 7.2.1 and I still see the issue:
|
I still see this issue with
|
@Zaehiel could you supply me with a reproduction repository? That way I could investigate. |
@ndelangen EDIT: [email protected] |
@ndelangen Hi, did you have time to examine my test file? |
Describe the bug
When navigating through stories, this error pops up.
The problem seems to come from
where name2 is actually
{ name : "string" }
Steps to reproduce the behavior
The following script seems to be enough for Storybook to throw errors.
The project where it fails can be found here
Expected behavior
The parsing should work
The text was updated successfully, but these errors were encountered: