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: Fix storySort order with whitespace in story paths #15038

Merged
merged 2 commits into from May 26, 2021

Conversation

ghengeveld
Copy link
Member

Issue: #13311

What I did

This consistently splits kind in a way that allows whitespace around the path separator. This was already implemented in the stories API using trim() on each part, but a regex separator is more efficient and less fragile. The storySort function didn't do this yet, which is why manually specifying an order only worked when including the whitespace in each value (see #13311).

Technically this is a breaking change, because it'll break ordering for people who've specified order including whitespace. We could circumvent that by trimming values of order. WDYT @shilman ?

How to test

  • Is this testable with Jest or Chromatic screenshots? Updated the unit test
  • Does this need a new example in the kitchen sink apps? No
  • Does this need an update to the documentation? No

If your answer is yes to any of these, please make sure to include it in your PR.

@nx-cloud
Copy link

nx-cloud bot commented May 25, 2021

Nx Cloud Report

CI ran the following commands for commit 8c20356. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

@nx-cloud
Copy link

nx-cloud bot commented May 25, 2021

Nx Cloud Report

We didn't find any information for the current pull request with the commit 0a4b5be.
Please make sure you set the \ NX_BRANCH\ environment variable in your CI pipeline .

Check the Getting started section to configure the app.


Sent with 💌 from NxCloud.

@ghengeveld ghengeveld changed the title Story path ('kind') can have spaces around separators Core: Fix storySort order with whitespace in story paths May 25, 2021
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! Thanks @ghengeveld 🙏

This just looks like a bug to me, and if ends up being a breaking change for some people let's see if people complain and update then. I don't think we need to overcomplicate it.

@shilman
Copy link
Member

shilman commented May 26, 2021

@ghengeveld there's a failing unit test tho! 🔍 ❌

@ghengeveld ghengeveld merged commit 95f5bfd into next May 26, 2021
@ghengeveld ghengeveld deleted the 13311-storySort-order-whitespace branch May 26, 2021 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants