If you are reporting a bug or requesting support, start here:
_Please provide issue details here - What did you expect to happen? What happened instead?_
The Source Code section in the Info addon is unable to show source code when it is in a render prop.
Why would this be a useful feature?
I would like to document a component which is a React consumer:
<SessionConsumer>
{ (session) => <h1>Hello {session.username}!</h1> }
</SessionConsumer>
However, the info addon chooses to decompose the React element it's received, rather than just parse the text out of the source code. I gather it does this to enable MaxProps etc and perhaps to standardize spacing?
I wonder if these features are worth the difficulty they introduce: namely, that the info addon can only show source code that can be trivially traversed as react element trees. It seems to me that the 95% use case for the source code panel is to see _identically_ the code in the story. Alternatively, should there be another (mutually exclusive) option to try to provide the source from the story?
Can be seen here: https://github.com/amacleay/storybook/tree/render-prop-source
yarn bootstrapexamples/cra-kitchen-sink and run it: yarn storybookwith info and a render propAll
const PassthroughRenderProp = ({ children }) => children();
...
.add(
'with info and a render prop',
withInfo('The source code should be visible')(() => (
<PassthroughRenderProp>
{() => (
<div>
<span>Check it</span>
Shouldn't my source code be visible?
</div>
)}
</PassthroughRenderProp>
))
)
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
I'm seeing the same behavior. Any way we could get this looked at? I can help, if need be.
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!
Why is this closed?
This is still an issue in version 5.1.9
Most helpful comment
I'm seeing the same behavior. Any way we could get this looked at? I can help, if need be.