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

Adding null check before clearing mouseDownTimeout #201

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

Conversation

nzayatz14
Copy link

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
Copy link

codecov bot commented Sep 25, 2020

Codecov Report

Merging #201 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           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           
Impacted Files Coverage Δ
src/index.tsx 83.78% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8b8cb2...67c7afc. Read the comment docs.

@shc023
Copy link

shc023 commented Jul 31, 2021

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants