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

Core: Use stable package to ensure story sorting is stable #8795

Merged
merged 1 commit into from Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/client-api/package.json
Expand Up @@ -40,6 +40,7 @@
"lodash": "^4.17.15",
"memoizerific": "^1.11.3",
"qs": "^6.6.0",
"stable": "^0.1.8",
"ts-dedent": "^1.1.0",
"util-deprecate": "^1.0.2"
},
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 dedent from 'ts-dedent';
import stable from 'stable';

import { Channel } from '@storybook/channels';
import Events from '@storybook/core-events';
Expand Down Expand Up @@ -129,7 +130,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