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

Optimize set(): avoid recreating popperInstance by comparing props #456

Merged
merged 2 commits into from
Mar 24, 2019

Conversation

atomiks
Copy link
Owner

@atomiks atomiks commented Mar 24, 2019

cc @KubaJastrz not sure if this type can be better

This will compare the previous props with the new options being passed to set() - if none of them changed, there is no point recreating the popperInstance (which is somewhat expensive).

This is mainly for the React wrapper which has no diffing (to conserve bundle size) because the props will always be passed to set() on each render, leading to the popperInstance being recreated each time. In the vanilla lib usually they won't be doing this [I think]

@KubaJastrz
Copy link
Collaborator

Fixed types in 8864d9c.

About eslint rule: to comply with the "array" setting, I'd have to write (keyof Props)[] which I find less readable, but I can revert it if you want.

@atomiks
Copy link
Owner Author

atomiks commented Mar 24, 2019

Great, thanks!

@atomiks atomiks merged commit 15da4e8 into master Mar 24, 2019
@atomiks atomiks deleted the optimize-set branch March 24, 2019 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants