Skip to content

fix: v-scroll directive event listener leak#1365

Open
rocka wants to merge 1 commit into
museui:masterfrom
rocka:master
Open

fix: v-scroll directive event listener leak#1365
rocka wants to merge 1 commit into
museui:masterfrom
rocka:master

Conversation

@rocka

@rocka rocka commented May 30, 2019

Copy link
Copy Markdown

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

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.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 29.98%. Comparing base (74f78df) to head (874031d).
⚠️ Report is 1 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1365      +/-   ##
==========================================
- Coverage   30.18%   29.98%   -0.20%     
==========================================
  Files         220      220              
  Lines        3578     3578              
  Branches      749      749              
==========================================
- Hits         1080     1073       -7     
- Misses       1880     1885       +5     
- Partials      618      620       +2     

☔ 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.

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.

3 participants