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

Selectively Call Reflow on Component Update #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jackricci
Copy link

@jackricci jackricci commented Sep 22, 2020

Since the reference equality check to compare previous props with the new props fails when new props are passed in that have the same values as the previous props, reflow was getting called every time the component re-rendered, leading to a huge performance hit.

By using LoDash's deep object equality comparison, we're able to eliminate unnecessary calls to reflow that are getting made when props hasn't changed.

Performance improvement:
On a page with 48 LinesEllipsis components already rendered, when I update the page to render an additional 24 LinesEllipses components:

  • With this PR: This takes ~2.5 seconds to paint all 72 LinesEllipses components to screen
  • Without this PR: This takes ~21 seconds to paint all 72 LinesEllipses components to screen

@jackricci jackricci changed the title Fix/Selectively Call Reflow on Component Update Selectively Call Reflow on Component Update Sep 22, 2020
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

1 participant