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

Story sorting #6472

Merged
merged 13 commits into from
Jun 27, 2019
Merged

Story sorting #6472

merged 13 commits into from
Jun 27, 2019

Conversation

snowystinger
Copy link
Contributor

@snowystinger snowystinger commented Apr 10, 2019

Issue: #6439

Story sorting now takes place in story_store. This is so that the Object.values returns the correct order and sorting is not needed elsewhere.

What I did

Added a Param to the global params called storySort which takes a sort function. If none is provided then the default alphabetical sort is used.

How to test

  • Is this testable with Jest or Chromatic screenshots? don't know yet
  • Does this need a new example in the kitchen sink apps? Is showcased in react kitchen sink
  • Does this need an update to the documentation? yes

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

It gets called with the right values, but it always returns 'undefined'
@vercel
Copy link

vercel bot commented Apr 10, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://monorepo-git-fork-snowystinger-feature-story-sorting.storybook.now.sh

@shilman
Copy link
Member

shilman commented Apr 10, 2019

@snowystinger Thanks for taking a go at this. I think the issue here is that config.js is running in the "preview" (user code) and it serializes the options over the channel to the "manager" (storybook UI code) and the function is not serializable.

I think @ndelangen is trying to address this with a unified config that makes configuring the preview and the manager easier.

@snowystinger
Copy link
Contributor Author

@shilman I thought that might be an issue, but got tripped up because the sorting function in config.js is getting called. It's just not returning anything. Where is @ndelangen working on this? I'd like to follow along if possible.

@ndelangen
Copy link
Member

@snowystinger I could brief you next week if you'd like.

I could use some company, possibly some pair programming would do me some good.

Tomorrow I'll be at React Amsterdam Conference, weekend I'll be resting, or at the very least trying to rest.

@ndelangen
Copy link
Member

What do you want to do with this PR?

@snowystinger
Copy link
Contributor Author

snowystinger commented Apr 11, 2019

@ndelangen happy to help out in any way :) and have time next week.
If this stuff happens in another PR, that's cool

One thought I did have was that I could take out the addParams bit and just auto sort alphabetically, then at least there'd be a deterministic way to deal with this until the sorting is exposed.

@Armanio
Copy link
Member

Armanio commented Apr 13, 2019

Good job! Thank you!
I left the mini notice. Check it, please.
Could you update docs?

Unsure if I should also remove the stuff for addParameters?
@snowystinger
Copy link
Contributor Author

@Armanio updated. Should I also remove the logic for pulling it from the parameters object for now?

@Armanio
Copy link
Member

Armanio commented Apr 13, 2019

No, I think everything is fine. 👍
Thank you, good job!
Let's wait other opinions.

@ndelangen ndelangen added this to the 5.2.0 milestone Apr 26, 2019
@ndelangen
Copy link
Member

Related to monoconfig

@ndelangen ndelangen removed their assignment Jun 19, 2019
@shilman shilman self-assigned this Jun 19, 2019
@shilman shilman merged commit 8b26918 into storybookjs:next Jun 27, 2019
@snowystinger snowystinger deleted the feature-story-sorting branch July 26, 2019 02:33
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.

6 participants