Skip to content

Adding null check before clearing mouseDownTimeout - #201

Open
nzayatz14 wants to merge 2 commits into
react-component:masterfrom
nzayatz14:master
Open

Adding null check before clearing mouseDownTimeout#201
nzayatz14 wants to merge 2 commits into
react-component:masterfrom
nzayatz14:master

Conversation

@nzayatz14

Copy link
Copy Markdown

Hello,

I was recently doing some performance testing on a virtual table component I had written. With rows constantly unmounting & remounting, I wanted to make sure the scroll was still smooth with tooltips (rc-tooltips to be exact).

During my tests, I noticed that a significant amount of my table cells needed to clear a timeout upon unmounting of the row, this caused lag in my scrolling.

Screen Shot 2020-09-25 at 3 59 39 PM

I found the call was made by rc-trigger in it's componentWillUnmount function. I added a simple null-check before the clearTimeout function and it significantly improved my scrolling performance.

I also noticed that the other timer, this.delayTimer, has its own function that handles this case -> this.clearDelayTimer() and was wondering why this.mouseDownTimeout did not have something similar.

Thanks!
Nick

@codecov

codecov Bot commented Sep 25, 2020

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.22%. Comparing base (b8b8cb2) to head (67c7afc).
⚠️ Report is 365 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #201   +/-   ##
=======================================
  Coverage   88.22%   88.22%           
=======================================
  Files          10       10           
  Lines         484      484           
  Branches      121      122    +1     
=======================================
  Hits          427      427           
  Misses         57       57           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@shc023

shc023 commented Jul 31, 2021

Copy link
Copy Markdown

I was also running into perf issue caused by the same code when unmounting 10k+ rc-tooltip at the same time. I made a PR that does this and also clears the pointer itself after executing, which potentially gives even more performance gain:

#278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants