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

Remove findDOMNode usage from the NavigableToolbar component #11401

Merged
merged 2 commits into from
Nov 6, 2018

Conversation

youknowriad
Copy link
Contributor

Related #11360

This PR ends up more complex that I though.

  • It adds forwardRef support to the NavigableMenu component
  • It upgrades Enzyme to support ref forwarding (it was simpler than rewriting using react-test-renderer)

@youknowriad youknowriad added the [Type] Code Quality Issues or PRs that relate to code quality label Nov 2, 2018
@youknowriad youknowriad self-assigned this Nov 2, 2018
@youknowriad youknowriad requested a review from a team November 2, 2018 11:52
@youknowriad youknowriad mentioned this pull request Nov 2, 2018
12 tasks
@gziolo gziolo self-requested a review November 5, 2018 08:25
@@ -0,0 +1,132 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank goodness for the new files. These components were always the hardest to find because of their non-obvious prior bundling.

@@ -0,0 +1,132 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Trim leading newline.

}

const forwardedNavigableContainer = ( props, ref ) => {
return <NavigableContainer { ...props } forwardedRef={ ref } />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: I think the ownProps pattern we've adopted elsewhere (e.g. withSelect) when we know we're just passing through props directly, to avoid wastefully iterating over the props in the pass-through.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that we have to change the inner component's implementation to adapt to this. I find it ok for higher-order components that need to be very performant but personally prefer to avoid it in regular components.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd agree in the sense of not surfacing it on the public API, but it seems perfectly fine (and arguably preferable) for internal pass-through components.

@youknowriad youknowriad force-pushed the remove/find-dom-node-toolbar branch from 3cb6e00 to f4a88cb Compare November 6, 2018 07:57
@youknowriad youknowriad merged commit 57d01f6 into master Nov 6, 2018
@youknowriad youknowriad deleted the remove/find-dom-node-toolbar branch November 6, 2018 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants