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

Conversation

tmeasday
Copy link
Member

Fixes #8792

Issue: stories.sort() was not guaranteed to be stable so if the compare function sometimes returned 0, the order was not defined.

What I did

Use a guaranteed stable sorting algorithm. This way the ordering will fall back to the original ordering (the order the stories were added).

How to test

  • Is this testable with Jest or Chromatic screenshots?

Check the library page of chromatic -- see this comment: #8792 (comment)

@vercel
Copy link

vercel bot commented Nov 11, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/1xf888odk
🌍 Preview: https://monorepo-git-8792-stable-sort.storybook.now.sh

@github-actions
Copy link
Contributor

Fails
🚫

PR is not labeled with one of: ["cleanup","doc-dependencies:update","BREAKING CHANGE","feature request","bug","documentation","maintenance","dependencies:update","dependencies","other"]

Generated by 🚫 dangerJS against ee614e8

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shilman shilman changed the title Use the stable package to ensure story sorting is stable. Core: Use stable package to ensure story sorting is stable Nov 11, 2019
@shilman shilman added bug core patch:yes Bugfix & documentation PR that need to be picked to main branch labels Nov 11, 2019
@shilman shilman added this to the 5.2.x milestone Nov 11, 2019
@tmeasday
Copy link
Member Author

@shilman shilman merged commit 6455fc9 into next Nov 12, 2019
@shilman shilman deleted the 8792-stable-sort branch November 12, 2019 03:53
shilman added a commit that referenced this pull request Dec 2, 2019
Core: Use `stable` package to ensure story sorting is stable
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Story sort should be stable
2 participants