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.
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
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.