Skip to content

Commit

Permalink
Core: Use stable package to ensure story sorting is stable (#8795)
Browse files Browse the repository at this point in the history
Core: Use `stable` package to ensure story sorting is stable
  • Loading branch information
shilman committed Dec 2, 2019
1 parent a815e55 commit d67633d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/client-api/package.json
Expand Up @@ -41,6 +41,7 @@
"lodash": "^4.17.15",
"memoizerific": "^1.11.3",
"qs": "^6.6.0",
"stable": "^0.1.8",
"util-deprecate": "^1.0.2"
},
"publishConfig": {
Expand Down
3 changes: 2 additions & 1 deletion lib/client-api/src/story_store.ts
Expand Up @@ -3,6 +3,7 @@ import EventEmitter from 'eventemitter3';
import memoize from 'memoizerific';
import debounce from 'lodash/debounce';
import { stripIndents } from 'common-tags';
import stable from 'stable';

import { Channel } from '@storybook/channels';
import Events from '@storybook/core-events';
Expand Down Expand Up @@ -126,7 +127,7 @@ export default class StoryStore extends EventEmitter {
);
if (index && this._data[index].parameters.options.storySort) {
const sortFn = this._data[index].parameters.options.storySort;
stories.sort(sortFn);
stable.inplace(stories, sortFn);
}
}
// removes function values from all stories so they are safe to transport over the channel
Expand Down

0 comments on commit d67633d

Please sign in to comment.