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(Sticky): scrollContext changes cause memory leak and incorrect scroll events #2464

Merged

Conversation

fracmak
Copy link
Member

@fracmak fracmak commented Jan 25, 2018

This PR is similar to #2458.

When the scrollContext prop changes, we don't change the event listeners so we don't fire scroll events on the new scrollContext, and continue to fire scroll events on the old listener. We also have a memory leak when the scrollContext changes and the component unmounts because it will remove the listener on the wrong scrollContext

I also added an if statement where if the scrollContext is null, it doesn't listen for scroll events similar to the change I made in #2458 so they now behave the same.

@codecov-io
Copy link

codecov-io commented Jan 25, 2018

Codecov Report

Merging #2464 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2464      +/-   ##
==========================================
+ Coverage   99.74%   99.74%   +<.01%     
==========================================
  Files         154      154              
  Lines        2699     2705       +6     
==========================================
+ Hits         2692     2698       +6     
  Misses          7        7
Impacted Files Coverage Δ
src/modules/Sticky/Sticky.js 100% <100%> (ø) ⬆️

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 aed4f01...e1f7fb3. Read the comment docs.

@levithomason
Copy link
Member

Superb, thanks for the very clean and complete PR.

@levithomason levithomason merged commit f8ab1f4 into Semantic-Org:master Feb 2, 2018
@balofg
Copy link

balofg commented Feb 2, 2018

When will this fix be released?

@levithomason
Copy link
Member

I hope this weekend. My family and I are quite sick at the moment.

@levithomason
Copy link
Member

levithomason commented Feb 4, 2018

@fracmak you've contributed a number of PRs and they are typically very well done. I've added you as a collaborator. You're now able to manage issues and PRs as well as create branches here in the main repo. Merging to master is the only reserved permission.

We are very select about who we add and when, so know that we trust your abilities and your judgment as to good code. Please feel free to weigh in on any issues and PRs that you have an opinion about. You have a share of ownership and say here now.

Once you accept the invite (see your email), you might want to show the Semantic Org badge publicly on your profile. To do that, navigate to the "people" page and change the "private" dropdown to "public" for your user in the table. Here's a direct link to your user in the table.

/cc @layershifter @brianespinosa Please welcome @fracmak (Jay) to our ranks 😄 🎉

@levithomason
Copy link
Member

Released in [email protected].

@balofg
Copy link

balofg commented Feb 5, 2018

Thanks, man! I really appreciate your effort.

@fracmak
Copy link
Member Author

fracmak commented Feb 5, 2018

Thanks @levithomason ! It's an honor to join the team and be trusted in helping manage the project!

Brantron pushed a commit to Brantron/Semantic-UI-React that referenced this pull request Mar 14, 2018
…roll events (Semantic-Org#2464)

* fix(Sticky): scrollContext changes cause memory leak and incorrect scroll events

* style(Sticky): update lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants