Storybook: Stories appearing in reverse order in v5.3.3

Created on 15 Jan 2020  路  7Comments  路  Source: storybookjs/storybook

Describe the bug
I upgraded from 5.3.2 to 5.3.3 today and my stories were displaying in reverse order than how they are exported (using CSF).

To Reproduce

  1. Write stories using CSF
  2. Observe that in the nav pane on the left they are in reverse order, including subcategories

Expected behavior
I would expect that the stories would be in the order that they were exported in, which is how they worked in 5.3.2.

System:

Environment Info:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 9.11.1 - ~/.nvm/versions/node/v9.11.1/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v9.11.1/bin/npm
  Browsers:
    Chrome: 79.0.3945.117
    Firefox: 70.0.1
    Safari: 13.0.4
  npmPackages:
    @storybook/addon-a11y: ^5.3.3 => 5.3.3 
    @storybook/addon-actions: ^5.3.3 => 5.3.3 
    @storybook/addon-links: ^5.3.3 => 5.3.3 
    @storybook/addons: ^5.3.3 => 5.3.3 
    @storybook/react: ^5.3.3 => 5.3.3 

Additional context
One thing to note is that if I force the sort order following the sorting stories guide, they appear in alphabetical order.

bug core high priority

All 7 comments

I think the problem has to do with this line in story_store.ts:

stable.inplace(stories, (s1, s2) => kindOrder[s1[1].kind] - kindOrder[s2[1].kind]);

I'm not entirely sure what it does, but it seems to sort the stories by their category, but amongst themselves. This process must inadvertently reverse the original order of the stories themselves?

This appears to be something new @shilman added two days ago in #9424 (to fix #9419). Maybe you can chime in?

Thanks for the issue @benmvp, can you just clarify with a screenshot -- is it the stories are the wrong order within a kind? Or are the kinds in the wrong order? Or both?

I'm experiencing this also after updating to 5.3.3. Seems it's now alphabetical? Here's the order I see now:

Screen Shot 2020-01-16 at 11 08 35

Before 5.3.3, "Default" was first.

@tmeasday thanks for the quick reply! It appears like both.

Here's a screenshot:
Screen Shot 2020-01-15 at 6 33 45 PM

The kinds used to be sorted alphabetically, and now they are backwards. The stories w/in the kind used to be sorted by their exports within the story file and now they are sorted in reverse.

Thanks @benmvp and @chris-pearce. Fix coming.

隆Ay Caramba!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.4 containing PR #9482 that references this issue. Upgrade today to try it out!

Closing this issue. Please re-open if you think there's still more to do.

Yup, that fixed it! Thanks! 馃帀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

43081j picture 43081j  路  61Comments

tycho01 picture tycho01  路  76Comments

ilyaulyanov picture ilyaulyanov  路  100Comments

bpeab picture bpeab  路  70Comments

firaskrichi picture firaskrichi  路  61Comments