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

fix: v-scroll directive event listener leak #1365

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rocka
Copy link

@rocka rocka commented May 30, 2019

There's a heavy event listener leak when using v-scroll directive.

image

The performance profile was captured in https://muse-ui.org/#/zh-CN/directives . When the page scrolls, there's just tons of event listeners been attached, but none of them got removed.

https://github.com/museui/muse-ui/blob/master/src/internal/directives/scroll.js#L38

I think the update function in this directive was totally unnecessary, according to Vue Custom Directive Guide.

To demonstrate this, there's a fiddle: https://jsfiddle.net/zgrxt69h/ . update was removed, and it still works fine.

@codecov-io
Copy link

Codecov Report

Merging #1365 into master will decrease coverage by 0.19%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1365     +/-   ##
=========================================
- Coverage   30.18%   29.98%   -0.2%     
=========================================
  Files         220      220             
  Lines        3578     3578             
  Branches      749      749             
=========================================
- Hits         1080     1073      -7     
- Misses       1880     1885      +5     
- Partials      618      620      +2
Impacted Files Coverage Δ
src/internal/directives/scroll.js 81.25% <ø> (ø) ⬆️
src/utils/dom.js 0% <0%> (-13.21%) ⬇️

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 74f78df...874031d. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants