Storybook: Categories are sorted but Stories order is uncertain

Created on 30 May 2018  路  8Comments  路  Source: storybookjs/storybook

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

options feature request

Most helpful comment

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

All 8 comments

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

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

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

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

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!

This is still an issue!

I am working on this PR to fix this issue
https://github.com/storybooks/storybook/pull/3963

PR was merged to master. Closing this issue then

Was this page helpful?
0 / 5 - 0 ratings