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

React: Upgrade react-docgen to v7 #24530

Merged
merged 6 commits into from
Oct 22, 2023
Merged

React: Upgrade react-docgen to v7 #24530

merged 6 commits into from
Oct 22, 2023

Conversation

shilman
Copy link
Member

@shilman shilman commented Oct 20, 2023

Closes N/A

What I did

  • Upgrade react-docgen to v7, which fixes React.FC support
  • Added a test/story to exercise the bug in v6

A couple notes about the test/story:

  1. Currently the story gets rendered in sandboxes, which use react-docgen-typescript by default, so you won't actually see the bug in next and the fix in this branch. However, in 8.0 when we make react-docgen the default it will be tested.
  2. The snapshot test currently uses babel-plugin-react-docgen, which has not been updated to 7.0, so it is showing the old value. This should also be updated in the future. Or the test should be fixed.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

In the react-vite-default-ts sandbox, update main.ts to use react-docgen for generating argTypes:

  typescript: {
    reactDocgen: 'react-docgen',
  },

Also, change the CLI template Button component definition to:

export const Button: React.FC<ButtonProps> = ({
  primary = false,
  size = 'medium',
  backgroundColor,
  label,
  ...props
}) => {  /* existing definition */ }

Browse the auto-generated controls on the Button stories. Remove the manually specified args and argTypes in the stories and verify that the controls still show up. (These will disappear using react-docgen@6 which is included in SB 7.5).

You may need to clear yarn.lock and reinstall the sandbox or regenerate from scratch to make sure you're using the right version.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

@socket-security
Copy link

New dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@storybook/linter-config 3.1.2 None +0 9.39 kB monkeyworks
react-docgen 7.0.0 None +6 274 kB danez
deep-object-diff 1.1.9 None +0 23.3 kB mattphillips

@shilman shilman merged commit ab8d966 into next Oct 22, 2023
15 checks passed
@shilman shilman deleted the shilman/react-docgen-7 branch October 22, 2023 10:50
@github-actions github-actions bot mentioned this pull request Oct 22, 2023
7 tasks
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