-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Addon-docs: Support <StrictMode />
and <Suspense />
in source viewer
#19785
Addon-docs: Support <StrictMode />
and <Suspense />
in source viewer
#19785
Conversation
…ion returns null.
(isMemo(el.type) ? el.type.type.name : null) || | ||
el.type, | ||
}; | ||
let displayNameDefaults; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major Change: displayNameDefaults.displayName
should be undefined
if getDocgenSection
returns null
:
storybook/code/lib/docs-tools/src/argTypes/docgen/utils/docgenInfo.ts
Lines 14 to 16 in 9a07fcb
export function getDocgenSection(component: Component, section: string): any { | |
return hasDocgen(component) ? component.__docgenInfo[section] : null; | |
} |
and then the logic will be handled by react-element-to-jsx-string
:
We don't need to rewrite redundant code here.
Hi @shilman I need your help with why Update: the error
the storybook/code/renderers/react/src/docs/jsxDecorator.tsx Lines 43 to 49 in 6e927f3
|
@shilman This PR is over a year old, what do you think of this PR / code-change? I'm tempted to just proceed. I'll re-target the base branch, merge the base branch in, and see what happens. If CI fails, then I do not have the resources to get this merged, and will likely have to close, unless @zhyd1997 has interest in getting CI green at that point. cc: @JReinhold |
Hi @ndelangen @shilman @IanVS @kasperpeulen @valentinpalkovic Anything I can do on my side to improve the code confidence? 👀 |
I don't know much about this code path TBH, but I like the tests and everything is passing, so I'm okay with merging it. |
<StrictMode />
and <Suspense />
in source viewer
Issue: #11554
What I did
Refactor:
storybook/code/renderers/react/src/docs/jsxDecorator.tsx
Lines 77 to 92 in 9a07fcb
So that we will not write redundant code here:
https://github.com/algolia/react-element-to-jsx-string/blob/984f26908c17cea134fa53d17ac51f179e5195b2/src/parser/parseReactElement.js#L47-L77
How to test
If your answer is yes to any of these, please make sure to include it in your PR.