-
Notifications
You must be signed in to change notification settings - Fork 47.9k
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
Support inner component _debugOwner in memo #18659
Conversation
Hi @hanq08! Thank you for your pull request and welcome to our community.We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 51a00f0:
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
}, | ||
] | ||
`; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This snapshot is out of date now. (Not your fault.) Rebasing on master would result in a snapshot delta of:
diff --git a/packages/react-devtools-shared/src/__tests__/__snapshots__/ownersListContext-test.js.snap b/packages/react-devtools-shared/src/__tests__/__snapshots__/ownersListContext-test.js.snap
index 7ef006fda..9b7609788 100644
--- a/packages/react-devtools-shared/src/__tests__/__snapshots__/ownersListContext-test.js.snap
+++ b/packages/react-devtools-shared/src/__tests__/__snapshots__/ownersListContext-test.js.snap
@@ -88,13 +88,17 @@ Array [
},
Object {
"displayName": "Anonymous",
- "hocDisplayNames": null,
+ "hocDisplayNames": Array [
+ "Memo",
+ ],
"id": 3,
"type": 8,
},
Object {
"displayName": "Anonymous",
- "hocDisplayNames": null,
+ "hocDisplayNames": Array [
+ "ForwardRef",
+ ],
"id": 4,
"type": 6,
},
@@ -206,4 +206,42 @@ describe('OwnersListContext', () => { | |||
|
|||
done(); | |||
}); | |||
|
|||
it('should include all owners for a component wrapped in react memo ', async done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
it('should include all owners for a component wrapped in react memo ', async done => { | |
it('should include all owners for a component wrapped in react memo', async done => { |
const InnerComponent = React.forwardRef((props, ref) => <div ref={ref} />); | ||
const Memo = React.memo(InnerComponent); | ||
const Grandparent = () => { | ||
const ref = React.createRef(); | ||
return <Memo ref={ref} />; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit Let's use a named function so we don't see "Anonymous" in the tests?
const InnerComponent = React.forwardRef((props, ref) => <div ref={ref} />); | |
const Memo = React.memo(InnerComponent); | |
const Grandparent = () => { | |
const ref = React.createRef(); | |
return <Memo ref={ref} />; | |
}; | |
const InnerComponent = (props, ref) => <div ref={ref} />; | |
const ForwardRef = React.forwardRef(InnerComponent); | |
const Memo = React.memo(ForwardRef); | |
const Grandparent = () => { | |
const ref = React.createRef(); | |
return <Memo ref={ref} />; | |
}; |
I removed my previous comment because it seems to have been in error. Digging in more. |
Moving things over to #19556 since I can't push to the branch this is based off of. Will land there. |
Summary
Add _debugOwner to inner component of memo.
#18571
Test Plan
one test added. Not familiar with the react test tool. let me know if it's good thanks.