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

Issue with onlyDocs page as homepage Story on alpha.30 #10294

Closed
matheo opened this issue Apr 2, 2020 · 14 comments
Closed

Issue with onlyDocs page as homepage Story on alpha.30 #10294

matheo opened this issue Apr 2, 2020 · 14 comments

Comments

@matheo
Copy link
Member

matheo commented Apr 2, 2020

Describe the bug

On alpha.28 I had no issues with this, but with the alpha.30 upgrade (coming with some @babel 7.9.0 updates), my initial Story is not being loaded.

I managed to sort my Stories adding the parameter options.storySort, so I have an MDX Story as my homepage, hiding the Canvas tab because it's onlyDocs:

<Meta
  title="Overview"
  parameters={{ previewTabs: { canvas: { hidden: true } } }}
/>

and it worked with alpha.28, but with alpha.30 I'm getting:
image

Expected behavior

The story should be loaded as it was with alpha.28.
I tried to add options.viewMode: 'docs' but it didn't change anything, it still tries to load the story of the docsOnly page, but that worked previously.
http://localhost:6001/?path=/story/overview--page

System:

Environment Info:

  System:
    OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 10.18.0 - ~/.nvm/versions/node/v10.18.0/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.14.2 - ~/.nvm/versions/node/v10.18.0/bin/npm
  Browsers:
    Chrome: 80.0.3987.149
    Firefox: 74.0
  npmPackages:
    @storybook/addon-a11y: ~6.0.0-alpha.30 => 6.0.0-alpha.30 
    @storybook/addon-actions: ~6.0.0-alpha.30 => 6.0.0-alpha.30 
    @storybook/addon-docs: ~6.0.0-alpha.30 => 6.0.0-alpha.30 
    @storybook/addon-knobs: ~6.0.0-alpha.30 => 6.0.0-alpha.30 
    @storybook/addon-links: ~6.0.0-alpha.30 => 6.0.0-alpha.30 
    @storybook/addon-viewport: ~6.0.0-alpha.30 => 6.0.0-alpha.30 
    @storybook/addons: ~6.0.0-alpha.30 => 6.0.0-alpha.30 
    @storybook/angular: ~6.0.0-alpha.30 => 6.0.0-alpha.30 
    @storybook/source-loader: ~6.0.0-alpha.30 => 6.0.0-alpha.30
@shilman
Copy link
Member

shilman commented Apr 3, 2020

@ndelangen is this composition-related? i don't think anything has changed on the docs side.

@matheo
Copy link
Member Author

matheo commented Apr 22, 2020

@shilman now upgrading to alpha.41 the same setup didn't load a single story, and no STORIES_CONFIGURED is triggered on my custom addon (added a console.log there to see what's up with the API)

@ndelangen
Copy link
Member

ndelangen commented Apr 23, 2020

@matheo change to:

// Emitted by the preview whenever the list of stories changes (in batches)
SET_STORIES = 'setStories',

I did an overhaul of the events for "storybook composition" and because of that the "STORIES_CONFIGURED" event was removed because it was adding complexity but not much in terms of functionality.

@matheo
Copy link
Member Author

matheo commented Apr 24, 2020

@ndelangen it doesn't work with alpha.43
I might downgrade to test with alpha.30 but doesn't make sense I guess.

Right now none of my stories are loaded,
the menu is not shown and SET_STORIES is not triggered
no error message in the console neither :(

@matheo
Copy link
Member Author

matheo commented Apr 24, 2020

My stories paths are:

[ '../design-system/**/*.stories.(ts|mdx)',
  '../packages/**/*.stories.(ts|mdx)' ]

and if I change them it complains about not finding the path relative to .storybook, so the config seems fine there, but not working in the other hand.

@matheo
Copy link
Member Author

matheo commented May 1, 2020

@ndelangen @shilman I've found this difference between the alpha.28 webpack config rules and the latest beta.0; this was the config on alpha.28:

{ test: /\.(stories|story).mdx$/,
          use:
           [ { loader: 'babel-loader',
               options: { plugins: [ '@babel/plugin-transform-react-jsx' ] } },
             { loader: '@mdx-js/loader',
               options:
                { compilers: [ [Function: compiler] ],
                  remarkPlugins: [ [Function: slug], [Function: externalLinks] ] } } ] },
        { test: /\.mdx$/,
          exclude: /\.(stories|story).mdx$/,
          use:
           [ { loader: 'babel-loader',
               options: { plugins: [ '@babel/plugin-transform-react-jsx' ] } },
             { loader: '@mdx-js/loader',
               options:
                { remarkPlugins: [ [Function: slug], [Function: externalLinks] ] } } ] },
        { test: /\.ts$/,
          exclude: /\.stories\.ts$/,
          use:
           [ { loader:
                '/my/git/repo/node_modules/awesome-typescript-loader/dist/entry.js',
               options:
                { configFileName:
                   '/my/git/repo/configs/storybook.tsconfig.json',
                  useCache: true } } ] },

and this is how it looks now:

{ test: /\.(stories|story).mdx$/,
          use:
           [ { loader: 'babel-loader',
               options:
                { cacheDirectory:
                   '/my/git/repo/node_modules/.cache/storybook/babel',
                  sourceType: 'unambiguous',
                  presets:
                   [ [ '/my/git/repo/node_modules/@babel/preset-env/lib/index.js',
                       { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' } ] ],
                  plugins:
                   [ '/my/git/repo/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js',
                     '/my/git/repo/node_modules/@babel/plugin-proposal-class-properties/lib/index.js',
                     '/my/git/repo/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js',
                     [ '/my/git/repo/node_modules/babel-plugin-emotion/dist/babel-plugin-emotion.cjs.js',
                       { sourceMap: true, autoLabel: true } ],
                     '/my/git/repo/node_modules/babel-plugin-macros/dist/index.js',
                     '@babel/plugin-transform-react-jsx' ] } },
             { loader: '@mdx-js/loader',
               options:
                { compilers: [ [Function: compiler] ],
                  remarkPlugins: [ [Function: slug], [Function: externalLinks] ] } } ] },
        { test: /\.mdx$/,
          exclude: /\.(stories|story).mdx$/,
          use:
           [ { loader: 'babel-loader',
               options:
                { cacheDirectory:
                   '/my/git/repo/node_modules/.cache/storybook/babel',
                  sourceType: 'unambiguous',
                  presets:
                   [ [ '/my/git/repo/node_modules/@babel/preset-env/lib/index.js',
                       { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' } ] ],
                  plugins:
                   [ '/my/git/repo/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js',
                     '/my/git/repo/node_modules/@babel/plugin-proposal-class-properties/lib/index.js',
                     '/my/git/repo/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js',
                     [ '/my/git/repo/node_modules/babel-plugin-emotion/dist/babel-plugin-emotion.cjs.js',
                       { sourceMap: true, autoLabel: true } ],
                     '/my/git/repo/node_modules/babel-plugin-macros/dist/index.js',
                     '@babel/plugin-transform-react-jsx' ] } },
             { loader: '@mdx-js/loader',
               options:
                { remarkPlugins: [ [Function: slug], [Function: externalLinks] ] } } ] },
        { test: /\.(stories|story)\.[tj]sx?$/,
          loader:
           '/my/git/repo/node_modules/@storybook/source-loader/dist/index.js',
          options: { inspectLocalDependencies: true },
          enforce: 'pre' },

I will remove my custom rule for *.stories.ts as it seems to conflict with the new rule, but I'm worried about the MDX files not being listed anyways.

Any way to debug the Store?
I installed React Developer Tools chrome extension but it only shows the components and an empty profiler right now

@ndelangen
Copy link
Member

@matheo would you want to debug this together sometime?

https://calendly.com/ndelangen/storybook

@matheo
Copy link
Member Author

matheo commented May 1, 2020

@ndelangen sure! I'd love to!
added a spot for tomorrow, or if you have some time tonight it would be nice

@ndelangen
Copy link
Member

@matheo would you be able to do a meeting on Monday perhaps?

@matheo
Copy link
Member Author

matheo commented May 1, 2020

@ndelangen sure, same time works for me

@shilman
Copy link
Member

shilman commented May 2, 2020

Possibly related: #10592 ?

@matheo
Copy link
Member Author

matheo commented May 5, 2020

@shilman yes!
I've confirmed that removing this made it:

addons.setConfig({
  previewTabs: {
    'storybook/docs/panel': { index: -1 },
  },
});

@stale
Copy link

stale bot commented May 30, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label May 30, 2020
@matheo matheo closed this as completed May 30, 2020
@matheo
Copy link
Member Author

matheo commented Jun 8, 2020

For the record, I've confirmed that this is no longer an issue in v6.0.0-beta.22

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

3 participants