-
-
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
fromId is not defined when using mdx format #6766
Comments
Some comments:
Try getting rid of those and maybe it will solve the problem? |
Also the preset change does not effect it, in my situation |
Oh, rename your file to |
Yes, that was the solution! Sorry for losing your time with this guys. |
I have the same issue in storybook 5.3.14
Solved: |
@eden-lane Hmm, the docs preset should set up |
This doc says nothing about preset so I didn't use it (I tried but it didn't work, so I just followed the steps from docs) |
@eden-lane this line is the preset:
|
SOLVED: : upgrading to 5.3.14 solved the problem! I have a similar issue using web-components and knobs addon. The Canvas tab works fine, but the docs tab pointing to Cannot read property 'fromId' of undefined I have this story file: import { html } from "lit-html";
import { Meta, Story, Preview, Props } from "@storybook/addon-docs/blocks";
import { withKnobs, text, boolean } from "@storybook/addon-knobs";
export const zButtonProps = () => ({
buttonid: text("buttonid", "id1"),
label: text("label", "my button"),
type: text("type", "primary"),
isdisabled: boolean("isdisabled", false),
issmall: boolean("issmall", false),
icon: text("icon", "download")
});
<Meta title="ZButton" component="z-button" decorators={[withKnobs]} />
# ZButton
// With `MDX` we can define a story for `ZButton` right in the middle of our markdown documentation.
<Preview>
<Story name="primary">
{html`
<z-button
isdisabled="${zButtonProps().isdisabled}"
label="${zButtonProps().label}"
buttonid="${zButtonProps().buttonid}"
type="${zButtonProps().type}"
issmall="${zButtonProps().issmall}"
icon="${zButtonProps().icon}"
></z-button>
`}
</Story>
</Preview>
<Props of="z-button" /> This is the module.exports = {
stories: [
// files MUST end with .story.mdx or .stories.mdx (@see https://github.com/storybookjs/storybook/issues/9918)
'../web-components-library/src/components/**/*.story.mdx',
'../web-components-library/src/components/**/*.stories.mdx',
],
addons: [
'@storybook/addon-viewport/register',
'@storybook/addon-knobs/register',
{
name: '@storybook/addon-docs',
options: {
configureJSX: true,
babelOptions: {},
sourceLoaderOptions: null,
},
},
],
}; And this is the import { setCustomElements } from '@storybook/web-components';
import customElements from '../web-components-library/custom-elements.json';
// bound generated Stencil documentation with Props table (https://github.com/storybookjs/storybook/blob/next/addons/docs/web-components/README.md)
setCustomElements(customElements); This is the relevant part of the {
"version": 1.1,
"tags": [
{
"name": "z-button",
"description": {
"kind": "markdown",
"value": "<!-- readme-group=\"buttons\" -->\n\n```html\n<z-button label=\"button\" type=\"primary\"></z-button>\n<z-button label=\"button\" type=\"primary\" icon=\"download\"></z-button>\n<z-button label=\"button\" type=\"primary\" isdisabled icon=\"download\"></z-button>\n<z-button label=\"button\" type=\"secondary\"></z-button>\n<z-button label=\"button\" type=\"secondary\" isdisabled></z-button>\n<z-button label=\"button\" type=\"tertiary\"></z-button>\n<z-button label=\"button\" type=\"tertiary\" isdisabled></z-button>\n<z-button label=\"button\" type=\"primary\" issmall></z-button>\n<z-button label=\"button\" type=\"primary\" issmall icon=\"download\"></z-button>\n<z-button label=\"button\" type=\"primary\" issmall isdisabled icon=\"download\"></z-button>\n<z-button label=\"button\" type=\"secondary\" issmall></z-button>\n<z-button label=\"button\" type=\"secondary\" issmall isdisabled></z-button>\n<z-button label=\"button\" type=\"tertiary\" issmall></z-button>\n<z-button label=\"button\" type=\"tertiary\" issmall isdisabled></z-button>\n```"
},
"attributes": [
{
"name": "buttonid",
"description": "id, should be unique"
},
{
"name": "icon",
"description": "add an icon to button (optional)"
},
{
"name": "isdisabled",
"description": "disable button"
},
{
"name": "issmall",
"description": "reduce button size (optional)"
},
{
"name": "label",
"description": "label content"
},
{
"name": "type",
"description": "graphic variant"
}
]
}
] |
@shilman I get this OPs error when I use |
@bcbrian if it's a PNPM issue it could be something to do with react versions. |
@shilman Storybook/Angular is using an older version of React compared to the addon-packages. Probably causing the issue for me. |
Describe the bug
Alright, so I have been trying to translate some of my Docz .mdx files to storybook, with version
v5.2.0-alpha.4. And so far so good, I get the canvas tab to work, but when I navigate to the docs tab it crashes saying
Cannot read property 'fromId' of undefined
.To Reproduce
Steps to reproduce the behavior:
Install
@storybook/react
and@storybook/addon-docs
to version 5.2.0-alpha.4.Add the following configuration:
.storybook/config.js
.storybook/preset.js
.storybook/webpack.config.js
.storybook/addons.js
.storybook/.babelrc
stories/button.stories.mdx
Expected behavior
The Docs tab open, and shows the documentation
Screenshots
Code snippets
You can find them in the reproduce section.
System:
Additional context
I think I have added everything, If more information is needed, I will provide it!
The text was updated successfully, but these errors were encountered: