Navigation Menu

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 React.forwardedRef/memo props #8445

Merged
merged 4 commits into from Oct 19, 2019

Conversation

darmawanalbert
Copy link
Contributor

Issue: #7933

What I did

Fix Props block rendering issue when using React.forwardRef by checking whether the target should be calling render() first to get the list of propTypes or not.

How to test

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

@vercel
Copy link

vercel bot commented Oct 16, 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/pude9nc6y
🌍 Preview: https://monorepo-git-fork-darmawanalbert-addon-docs-forward-ref-props.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.

Thank you @darmawanalbert -- this is really awesome!!

This code makes sense, but since it's React-specific, would it be possible to put it inside the getPropDefs function returned from inferPropDefs?

Also, if it's a similar fix, would you mind also adding React.memo support and test case while you're at it?

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.

Meant to request changes in my prev review :)

@shilman shilman added addon: docs bug patch:yes Bugfix & documentation PR that need to be picked to main branch labels Oct 16, 2019
@shilman shilman added this to the 5.2.x milestone Oct 16, 2019
@shilman shilman self-assigned this Oct 16, 2019
@darmawanalbert
Copy link
Contributor Author

@shilman sure, let me try it on React.memo()

@vercel vercel bot temporarily deployed to staging October 18, 2019 10:15 Inactive
@darmawanalbert
Copy link
Contributor Author

darmawanalbert commented Oct 18, 2019

@shilman I have added another logic to fix React.memo case and move it to getPropDefs function 🙇

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.

This is freakin' awesome @darmawanalbert! Thanks so much for the fix!!!

@shilman shilman changed the title fix(Addon Docs): Fix Props block rendering issue on forwardedRef Addon-docs: Fix React.forwardedRef/memo props Oct 19, 2019
@shilman shilman merged commit 93d9608 into storybookjs:next Oct 19, 2019
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Oct 22, 2019
shilman added a commit that referenced this pull request Oct 22, 2019
Addon-docs: Fix React.forwardedRef/memo props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: docs bug 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.

None yet

2 participants