-
-
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
[Bug]: Decorators causes source snippets in docs to show <No Display Name />
#21649
Comments
We agreed to default |
Here's the PR to do that: #21722 Do we have any idea where this actual issue stems from? It's not correct to say
as I mentioned on #21722, that change actually fixed a bug that you couldn't previously see decorators you'd added in The real bug here is why you can't see any deeper inside the provider decorator, and it says In any case, I agree this should be dropped from Required from GA now. |
Ok, I think the reason is that the decorator in question does something like: (Story) => <div><Story /></div> I guess React sees the If you change the decorator to (Story) => <div>{Story()}</div> It works, but that's not really an idiomatic React decorator. |
@tmeasday I'm not sure how react-element-to-jsx-string works under the hood & how easy it would be to add recursion support, but it's not a library option so it would be a (possibly small) project to get it working |
OK. I wonder if we should consider dropping the option entirely for React then, given the value of "showing decorators and not the story itself" seems pretty low. I guess some decorators might use the |
I think realistically we are not going to update the library to look "inside" React elements, so I would close this as WONTFIX, unless there is a simper fix we can do to change |
Closing this as per ☝🏼 , but please let me know if this should be reopened! |
Describe the bug
If you have a decorator, the source snippet in docs mode will not show the story's source, but instead the decorator with a
<No Display Name />
child.This bug was likely introduced by #21182, as applying
makes it work again.
To Reproduce
No response
System
No response
Additional context
https://chromaticqa.slack.com/archives/C03BNCJ8C7K/p1679047287634789
v7.0.0-rc.3 - Vite
v7.0.0-beta.54 - Vite
v6.5.9 - CRA
https://5f84c5baa35bdd0022a7684f-mvszeeebuw.chromatic.com/?path=/docs/components-restaurantcard--default
The text was updated successfully, but these errors were encountered: