Skip to content
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

[Bug]: docs tab not display in storybook ui #27023

Open
jon9090 opened this issue May 4, 2024 · 6 comments
Open

[Bug]: docs tab not display in storybook ui #27023

jon9090 opened this issue May 4, 2024 · 6 comments

Comments

@jon9090
Copy link

jon9090 commented May 4, 2024

Describe the bug

I utilize Storybook alongside Angular. I've included @storybook/addon-docs to showcase the code tab, but it's not rendering in the Storybook UI.

What might be causing this issue? Am I overlooking something, or could it be a bug?

package.json:

"@storybook/addon-docs": "^8.0.9",
"@nx/storybook": "18.3.4",
"@storybook/angular": "7.6.18",

main.ts:

import type { StorybookConfig } from '@storybook/angular';

const config: StorybookConfig = {
  stories: ['../../../**/*.stories.@(js|jsx|ts|tsx|mdx)'],
  addons: ['@storybook/addon-essentials', '@storybook/addon-interactions', 'storybook-addon-angular-router', "@storybook/addon-docs"],
  framework: {
    name: '@storybook/angular',
    options: { },
  },
};

export default config;

// To customize your webpack configuration you can use the webpackFinal field.
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
// and https://nx.dev/recipes/storybook/custom-builder-configs
image

To Reproduce

const meta: Meta<FooComponent> = {
  component: FooComponent,
  title: 'FooComponent'
};

export default meta;
type Story = StoryObj<FooComponent>;

export const Primary: Story = {
  parameters: {
    docs: { source: { state: 'open' } },
  },
  args: {}
};

System

Storybook Environment Info:

  System:
    OS: macOS 14.4.1
    CPU: (8) arm64 Apple M2
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn <----- active
    npm: 10.5.0 - /usr/local/bin/npm
    pnpm: 8.6.11 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.119
    Edge: 124.0.2478.80
    Safari: 17.4.1
  npmPackages:
    @storybook/addon-docs: ^8.0.9 => 8.0.9
    @storybook/addon-essentials: 7.6.18 => 7.6.18
    @storybook/addon-interactions: ^7.5.3 => 7.6.18
    @storybook/addon-storysource: ^8.0.9 => 8.0.9
    @storybook/angular: 7.6.18 => 7.6.18
    @storybook/core-server: 7.6.18 => 7.6.18
    @storybook/html-vite: ^8.0.9 => 8.0.9
    @storybook/jest: ^0.2.3 => 0.2.3
    @storybook/test-runner: ^0.13.0 => 0.13.0
    @storybook/testing-library: ^0.2.2 => 0.2.2
    storybook-addon-angular-router: ^1.10.0 => 1.10.0


### Additional context

_No response_
@kangaroo19
Copy link

import type { StorybookConfig } from '@storybook/angular';

const config: StorybookConfig = {
  stories: ['../../../**/*.stories.@(js|jsx|ts|tsx|mdx)'],
  addons: ['@storybook/addon-essentials', '@storybook/addon-interactions', 'storybook-addon-angular-router', "@storybook/addon-docs"],
  framework: {
    name: '@storybook/angular',
    options: { },
  },
  docs: {   /* add this code */
    autodocs: true,
  },
};

export default config;

i 've solved that problem by adding that code

@jon9090
Copy link
Author

jon9090 commented May 7, 2024

@kangaroo19 I did:

 docs: {   /* add this code */
    autodocs: true,
  },

but it throw an error:

(0 , react__WEBPACK_IMPORTED_MODULE_0__.useContext)(...).componentStoriesFromCSFFile is not a function
TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_0__.useContext)(...).componentStoriesFromCSFFile is not a function
    at Primary (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:5836:83)
    at Nh (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:38555:7)
    at Vk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41737:11)
    at Uk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41431:11)
    at Tk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41425:23)
    at Ik (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41411:5)
    at Nk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41134:7)
    at Gk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41071:51)
    at J (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:42973:17)
    at MessagePort.R (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:43004:11)

@kangaroo19
Copy link

could you show me your any stories.ts code?

@wangmeijian
Copy link

@kangaroo19 I did:

 docs: {   /* add this code */
    autodocs: true,
  },

but it throw an error:

(0 , react__WEBPACK_IMPORTED_MODULE_0__.useContext)(...).componentStoriesFromCSFFile is not a function
TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_0__.useContext)(...).componentStoriesFromCSFFile is not a function
    at Primary (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:5836:83)
    at Nh (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:38555:7)
    at Vk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41737:11)
    at Uk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41431:11)
    at Tk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41425:23)
    at Ik (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41411:5)
    at Nk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41134:7)
    at Gk (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:41071:51)
    at J (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:42973:17)
    at MessagePort.R (http://localhost:4400/vendors-node_modules_storybook_addon-docs_dist_DocsRenderer-K4EAMTCU_mjs.iframe.bundle.js:43004:11)

the same issue

@valentinpalkovic
Copy link
Contributor

You have a mix of Storybook 8 and 7 dependencies. Please make sure that all Storybook dependencies are using the same version.

@wangmeijian
Copy link

wangmeijian commented May 20, 2024

You have a mix of Storybook 8 and 7 dependencies. Please make sure that all Storybook dependencies are using the same version.

no, my dependencies version is 8.1.1 all @valentinpalkovic

"@chromatic-com/storybook": "^1",
"@storybook/addon-essentials": "^8.1.1",
"@storybook/addon-interactions": "^8.1.1",
"@storybook/addon-links": "^8.1.1",
"@storybook/addon-mdx-gfm": "^8.1.1",
"@storybook/blocks": "^8.1.1",
"@storybook/testing-library": "^0.2.2",
"@storybook/vue3": "^8.1.1",
"@storybook/vue3-vite": "^8.1.1",
"storybook": "^8.1.1",

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

No branches or pull requests

5 participants