storybook: Cannot read properties of undefined (reading 'id')

Hi everyone, I’m using @storybook/vue to make my storybook and I’m trying to embed a view component in my mdx files but I get these errors: “Cannot read properties of undefined (reading ‘id’)” and “The above error occurred in the <Canvas> component”. I’ve been looking for a solution on different forums but I can’t find it. Does anyone have a solution?

my code : button.docs.mdx

import { Canvas, Meta, Story } from '@storybook/addon-docs';
import Table from "@/stories/stories-component/Table.vue";

<Meta title="Bootstrap Custom Button Documentation" />

# Test

<Canvas>
    <Story name="test table">
        {() => {
            return {
                components: { Table },
                template: `<Table></Table>`
            };
        }}
    </Story>
</Canvas>

Table.vue

<template>
    <p>test component </p>
</template>
<script>
export default {
    name:"Table",
    props: {}
}
</script>

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 13
  • Comments: 18 (8 by maintainers)

Most upvoted comments

The solution for me was to include certain addons instead of relying on @storybook/addon-essentials.

My guess is that @storybook/addon-essentials configures the addons with different defaults than the individual addons or there is some sort of race condition that is resolved by including the addons individually. I’m not really sure.

My main.js:

...
module.exports = {
  ...
  addons: [
    // https://github.com/storybookjs/storybook/tree/main/addons/essentials#configuration
    // Note: These individual addons needed.
    '@storybook/addon-actions',
    '@storybook/addon-docs',
    '@storybook/addon-controls',

    // Contains docs, actions, controls, viewport, toolbar, and globals
    '@storybook/addon-essentials',
    ...
  ],
  ...
}
...

Thank you for the information that helped resolve this problem. I had installed many add-ons that caused conflicts. I kept only the essential ones, and then the problem was resolved.

The solution for me was to include certain addons instead of relying on @storybook/addon-essentials.

My guess is that @storybook/addon-essentials configures the addons with different defaults than the individual addons or there is some sort of race condition that is resolved by including the addons individually. I’m not really sure.

My main.js:

...
module.exports = {
  ...
  addons: [
    // https://github.com/storybookjs/storybook/tree/main/addons/essentials#configuration
    // Note: These individual addons needed.
    '@storybook/addon-actions',
    '@storybook/addon-docs',
    '@storybook/addon-controls',

    // Contains docs, actions, controls, viewport, toolbar, and globals
    '@storybook/addon-essentials',
    ...
  ],
  ...
}
...

@tibdev78 okay, good news for you!! For us, we only have xxx.stories.js files so I think it’s still not working 😦

Solution found, it’s because my file had this format component.mdx instead of components.stories.mdx