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

Categories are sorted but Stories order is uncertain #3688

Closed
dioxmio opened this issue May 30, 2018 · 8 comments
Closed

Categories are sorted but Stories order is uncertain #3688

dioxmio opened this issue May 30, 2018 · 8 comments

Comments

@dioxmio
Copy link
Contributor

dioxmio commented May 30, 2018

Bug or support request summary

Sorting is only working for high level items, not for stories. Tried used the provided option sortStoriesByKind

Steps to reproduce

storiesOf('1. Fields', module)
    .add('2. item2', () => </>);

storiesOf('1. Fields', module)
    .add('1. item1', () => </>);

storiesOf('1. Fields', module)
    .add('3. item3', () => </>);

storiesOf('2. Layout', module)
    .add('3. item3', () => </>);

setOptions({ sortStoriesByKind: true, });

will only order 1. Fields 2. Layout but inside 1. Fields items will not be sorted

Please specify which version of Storybook and optionally any affected addons that you're running

  • @storybook/addon-options 3.4.2

Acceptance criteria

All items need to be sorted

something like this can be done

function sort(stories, sortStoriesByKind) {
  if (!sortStoriesByKind) return stories;
  stories = stories.map((item) => {
    item.stories = sortBy(item.stories);
  }
  return sortBy(stories, ['kind']);
}

and problem will be solved. what do you think? I could create PR if needed :D

@Keraito
Copy link
Contributor

Keraito commented May 31, 2018

I edited your multiline codeblocks to use triple backticks for readability purposes.

@igor-dv
Copy link
Member

igor-dv commented Jun 4, 2018

@dioxmio, sounds legit, wanna PR?
Not sure if it's breaking change or not though...

@dioxmio
Copy link
Contributor Author

dioxmio commented Jun 4, 2018

sure, I will try to create the PR this week @igor-dv :D

@EskelCz
Copy link
Contributor

EskelCz commented Jun 13, 2018

@dioxmio bump pretty please :)
can reproduce, things get messy without sorting

@stale
Copy link

stale bot commented Jul 18, 2018

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 Jul 18, 2018
@pkuczynski
Copy link

This is still an issue!

@stale stale bot removed the inactive label Aug 3, 2018
@dioxmio
Copy link
Contributor Author

dioxmio commented Aug 5, 2018

I am working on this PR to fix this issue
#3963

@dioxmio
Copy link
Contributor Author

dioxmio commented Aug 7, 2018

PR was merged to master. Closing this issue then

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