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

Stories appearing in reverse order in v5.3.3 #9477

Closed
benmvp opened this issue Jan 15, 2020 · 7 comments
Closed

Stories appearing in reverse order in v5.3.3 #9477

benmvp opened this issue Jan 15, 2020 · 7 comments
Assignees
Milestone

Comments

@benmvp
Copy link

benmvp commented Jan 15, 2020

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.

@benmvp
Copy link
Author

benmvp commented Jan 15, 2020

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?

@tmeasday
Copy link
Member

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?

@chris-pearce
Copy link

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.

@benmvp
Copy link
Author

benmvp commented Jan 16, 2020

@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.

@tmeasday
Copy link
Member

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

@shilman
Copy link
Member

shilman commented Jan 16, 2020

¡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.

@benmvp
Copy link
Author

benmvp commented Jan 16, 2020

Yup, that fixed it! Thanks! 🎉

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

4 participants