question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stories are not sorted by their export (in production)

See original GitHub issue

Describe the bug In production, stories are not sorted according to their export instead, they are sorted alphabetically.

How they should be sorted (working correctly in dev): image

How they are actually sorted (in production): image

To Reproduce I’ve tried to create an example but I could not reproduce the bug. Here is a working example: https://github.com/inovex/elements

  1. Pull repo
  2. Run yarn install
  3. Run yarn start
  4. See that the sorting is correct
  5. Run cd packages/storybook
  6. Run yarn build
  7. Run cd dist
  8. Serve built content (e.g. serve .)
  9. See wrong sorting order

Everything related to the storybook can be found under packages/storybook.

System

  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  Binaries:
    Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v14.16.1/bin/yarn
    npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Firefox: 89.0
    Safari: 14.1.1
  npmPackages: (added manually because of monorepo)
	"@storybook/addon-actions": "^6.3.2",
    "@storybook/addon-essentials": "^6.3.2",
    "@storybook/addon-links": "^6.3.2",
    "@storybook/addon-viewport": "^6.3.2",
    "@storybook/builder-webpack5": "^6.3.2",
    "@storybook/manager-webpack5": "^6.3.2",
    "@storybook/theming": "^6.3.2",
    "@storybook/web-components": "^6.3.2",

Additional context It seems to be related to this issue: https://github.com/storybookjs/storybook/issues/15305

I’ve tried to sort the stories manually within the preview.js but it only sorted the entries in the sidebar but not the actual content on the canvas. Meaning, I would click on the story on the top of the sidebar, leading me to the rendered story at the bottom of the page in the canvas.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:14
  • Comments:43 (21 by maintainers)

github_iconTop GitHub Comments

13reactions
liverantcommented, Mar 24, 2022

With the new version:

 "@nrwl/storybook": "^13.10.0-beta.1",
    "@storybook/addon-docs": "^6.5.0-alpha.50",
    "@storybook/addon-essentials": "^6.5.0-alpha.50",
    "@storybook/addon-viewport": "^6.5.0-alpha.50",
    "@storybook/angular": "^6.5.0-alpha.50",
    "@storybook/builder-webpack5": "^6.5.0-alpha.50",
    "@storybook/manager-webpack5": "^6.5.0-alpha.50",

And the default config (preview.js):

export const parameters = {
  viewMode: 'docs',
  docs: {
    inlineStories: true,
    container: DocsContainer,
    page: DocsPage,
    source: {
      state: 'open',
    },
  },
  viewport: {
    viewports: INITIAL_VIEWPORTS,
  },
};

Stories in prod build are still not in their imported order (“Playground” should be first, instead we get alphabetical order) image

@shilman can you reopen?

5reactions
fabpicocommented, May 12, 2022

Since I’ve upgraded from an older version (using Webpack 4) to version 6.4.22 using (Webpack 5), I have this phenomena already on dev mode. The stories all seem to be sorted alphabetically by default now. But the Official docs says By default, stories are sorted in the order in which they were imported., which is not the case anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stories are not sorted by their export (in production) #15574
Describe the bug In production, stories are not sorted according to their export instead, they are sorted alphabetically. How they should be sorted...
Read more >
How to troubleshoot storybook not loading stories?
Resave save the story file. It makes the component reappear in side panel, and then you can see the errors ...
Read more >
Configure Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
Export final mastering files with Final Cut Pro - Apple Support
In Final Cut Pro, use the Export File destination to export your project as a high-quality file for professional post-production, broadcast, ...
Read more >
The Contentious U.S.-China Trade Relationship
A Chinese worker rushes to produce stainless steel products for export. ... there was virtually no trade between the two countries as Washington...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found