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

Components: Remove Popover isOpen prop, render by presence #5015

Merged
merged 3 commits into from
Feb 13, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Feb 13, 2018

This pull request seeks to refactor the Popover component to remove the isOpen prop and instead infer openness by its presence.

The goal with this change is that it avoids render logic of rendered children from being executed except when the Popover is in-fact visible, thus avoiding wasted render reconciliation.

Before:

<Popover isOpen={ isOpen }>Content</Popover>

After:

{ isOpen && <Popover>Content</Popover> }

Testing instructions:

Verify that there are no regressions in the behavior of any popovers, dropdown menus, and tooltips, including focus management (focus return, close on blur).

Ensure unit tests pass:

npm run test-unit

Already applied by Popover in all cases except when focusOnMount is false
@aduth aduth added [Feature] UI Components Impacts or related to the UI component system [Type] Performance Related to performance efforts labels Feb 13, 2018
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Tested several components and I can't find any noticeable regression.

Nice simplification 👍

@aduth aduth merged commit f836938 into master Feb 13, 2018
@mtias mtias deleted the remove/popover-is-open branch February 16, 2018 16:47
@aduth aduth mentioned this pull request Jul 2, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants