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

Addon-docs: Fix props table props sorting for PropTypes #8857

Merged
merged 6 commits into from
Nov 18, 2019
Merged

Conversation

patricklafrance
Copy link
Member

@patricklafrance patricklafrance commented Nov 18, 2019

Issue: #8539

What I did

The sorting problems comes from react-docgen that mess up the original sorting order of the props by returning first the props that have a default value.

My fix consist of using the original definition of the PropTypes object to re-order the props based on their original definition order.

This only fix the problem for PropTypes. If other frameworks or type systems have the same problem, they will also need to be fixed.

How to test

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

Jest: yarn jest --testPathPattern=handleProp
cra-ts-kitchen-sink: ?path=/docs/propssort--page

image

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

@vercel
Copy link

vercel bot commented Nov 18, 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/f76sf5dgg
🌍 Preview: https://monorepo-git-8539-props-sort.storybook.now.sh

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 Addon-docs: Fix props table props sorting issue for PropTypes Addon-docs: Fix props table props sorting for PropTypes Nov 18, 2019
@shilman shilman merged commit 9a08cdd into next Nov 18, 2019
@shilman shilman deleted the 8539-props-sort branch November 18, 2019 14:03
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.

2 participants