storybook: [Bug]: Cannot read properties of undefined (reading 'fonts')

Describe the bug

When using Source component in @storybook/blocks.

To Reproduce

not available yet.

System

Storybook Environment Info:

  System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    pnpm: 8.13.1 - ~/.nvm/versions/node/v20.12.2/bin/pnpm <----- active
  Browsers:
    Chrome: 123.0.6312.107
    Safari: 17.4.1
  npmPackages:
    @storybook/addon-essentials: ^8.0.8 => 8.0.8 
    @storybook/addon-interactions: ^8.0.8 => 8.0.8 
    @storybook/addon-links: ^8.0.8 => 8.0.8 
    @storybook/addon-storysource: ^8.0.8 => 8.0.8 
    @storybook/blocks: ^8.0.8 => 8.0.8 
    @storybook/manager-api: ^8.0.8 => 8.0.8 
    @storybook/react: ^8.0.8 => 8.0.8 
    @storybook/react-vite: ^8.0.8 => 8.0.8 
    @storybook/test: ^8.0.8 => 8.0.8 
    @storybook/test-runner: ^0.17.0 => 0.17.0 
    @storybook/theming: ^8.0.8 => 8.0.8 
    storybook: ^8.0.8 => 8.0.8 
    storybook-dark-mode: ^4.0.0 => 4.0.1

Additional context

It’s the cause by the typography is undefined in this line:

convert({ ...overrideTheme, fontCode: typography.fonts.mono...

which comes from let { typography } = useTheme();

I’m using tailwind, does it needs ThemeProvider?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 20 (5 by maintainers)

Most upvoted comments

In 8.1.11 version error seems to be returned

I can produce quite nicely locally since I cannot use <Canvas> in my app. I just thought to highlight this issue to the maintainers so they can remove the “needs repro” tag. I fear as long as this tag is there, this will not be fixed.