Skip to content

[Bug]: Invariant failed: expected a defaultName property in options.docs #23860

Closed

Description

Describe the bug

I get this error when starting storybook

WARN - ./components/v2/Dialog.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/Link.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/LinkButton.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/List.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/ListItem.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/Loading.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/MenuList.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/MenuListItem.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/PageColumn.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/PageHeader.stories.tsx: Invariant failed: expected a defaultName property in options.docs
WARN - ./components/v2/PageLoading.stories.tsx: Invariant failed: expected a defaultName property in options.docs

MenuListItem.stories.tsx

import { TagIcon } from "@heroicons/react/outline";
import { ComponentMeta, ComponentStory } from "@storybook/react";
import { MenuListItem } from "./MenuListItem";

export default {
  title: "Components/v2/MenuListItem",
  component: MenuListItem,
} as ComponentMeta<typeof MenuListItem>;

const Template: ComponentStory<typeof MenuListItem> = (args) => (
  <ul>
    <MenuListItem {...args} />
  </ul>
);

export const Default = Template.bind({});
Default.args = {
  icon: <TagIcon className="w-6 h-6 text-green-500" />,
  children: "This is a menu item",
  href: "/",
};
image

Lots of it is old storybook format.

I upgraded from Storybook 7.1 to 7.3

It did not solve it upgrading to the new storybook format
$ npx storybook@next migrate csf-2-to-3 --glob="**/*.stories.tsx"

To Reproduce

$ npm run storybook

drive@1.0.0 storybook
storybook dev --port 10000

@storybook/cli v7.3.1

System

$ npx storybook@latest info

Environment Info:

  System:
    OS: macOS 13.4.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
  Browsers:
    Chrome: 115.0.5790.170
    Safari: 16.5.2
  npmPackages:
    @storybook/addon-actions: 7.3.1 => 7.3.1
    @storybook/addon-links: 7.3.1 => 7.3.1
    @storybook/react: 7.3.1 => 7.3.1

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions