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

[getComponentName] Add logic to handle React.memo #65

Merged
merged 1 commit into from Aug 13, 2019

Conversation

@noratarano
Copy link

commented Aug 13, 2019

Summary

Add logic to handle React.memo names. This is how the react lib does it:

https://github.com/facebook/react/blob/master/packages/shared/getComponentName.js#L82-L83

Reviewers

@ljharb WDYT?

@ljharb

ljharb approved these changes Aug 13, 2019

Copy link
Collaborator

left a comment

Awesome! Looks like we need the same logic for React.lazy as well.

@@ -16,6 +17,20 @@ describe('getComponentName', () => {
expect(getComponentName(Foo)).to.equal(Foo.displayName);
});

it('given a memo, returns the name or displayName', () => {

This comment has been minimized.

Copy link
@ljharb

ljharb Aug 13, 2019

Collaborator

Not every tested React version has React.memo available.

Suggested change
it('given a memo, returns the name or displayName', () => {
(React.memo ? it : it.skip)('given a memo, returns the name or displayName', () => {

This comment has been minimized.

Copy link
@ljharb

ljharb Aug 13, 2019

Collaborator

i'm actually super confused how this test passed on React 15 and 0.14.

This comment has been minimized.

Copy link
@ljharb

ljharb Aug 13, 2019

Collaborator

turns out there's something wrong with the travis.yml; doesn't have to be a blocker here.

@ljharb ljharb merged commit 9ec14a5 into master Aug 13, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ljharb

This comment has been minimized.

Copy link
Collaborator

commented Aug 13, 2019

will release after i get the tests fixed.

@ljharb ljharb deleted the nora--get-memo-component-name branch Aug 13, 2019

@ljharb

This comment has been minimized.

Copy link
Collaborator

commented Aug 14, 2019

v2.15.0 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.