-
-
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: Inline rendering support for loaders #12726
Comments
You could add const MyStory = {
title: '',
component: MyComponent,
parameters: {
docs: {
inlineStories: false,
}
}
loaders: [
async () => ({
configs: (await getConfigs()).data,
}),
],
}
export default MyStory
export const Default = (args, { loaded: { configs } }) => (
<MyComponent {...args} {...configs} />
)
// this is what you will see on the Docs page.
const MyStoryCodeTemplate = (MyComponent) => `
<${MyComponent} {...props} />
`
Default.parameters = {
docs: {
source: {
code: MyStoryCodeTemplate('MyComponent'),
},
},
} |
Looks like #14911 (which mentions this issue) was merged, but that it did not actually resolve this issue. |
@MichaelAllenWarner no it was closed, not merged |
Oops—I blame my head cold. |
Is it still the case that I cannot use loaders in the docs, I am getting undefined as mentioned in this issue, but the issue is quite old. |
Thanks! This working for me in version |
#12699 adds async loaders to CSF, but the loaded data is not yet compatible with Storybook Docs inline rendering. Until this is added, the loaded data is undefined.
The text was updated successfully, but these errors were encountered: