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(ripple): Clean activation timer and css when interrupted (#2460) #2490

Merged
merged 5 commits into from
Apr 3, 2018

Conversation

deilv
Copy link
Contributor

@deilv deilv commented Mar 30, 2018

This commit adds a check in the ripple foundation's destroy function (as suggested by @kfranqueiro) and if the activation timer is active it's cleared. A unit test has also been added.

Fixes #2460.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@codecov-io
Copy link

codecov-io commented Mar 30, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2490      +/-   ##
==========================================
+ Coverage   98.87%   98.87%   +<.01%     
==========================================
  Files         102      102              
  Lines        4072     4077       +5     
  Branches      510      511       +1     
==========================================
+ Hits         4026     4031       +5     
  Misses         46       46
Impacted Files Coverage Δ
packages/mdc-ripple/foundation.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 306fd7f...9fab84d. Read the comment docs.

@deilv
Copy link
Contributor Author

deilv commented Mar 30, 2018

CLA signed

@googlebot
Copy link

CLAs look good, thanks!

@@ -176,6 +176,18 @@ testFoundation('#destroy removes all CSS variables', ({foundation, adapter, mock
});
});

testFoundation('#destroy clears the activation timer if pending',
({foundation, adapter, mockRaf}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this indentation and the presence of adapter when unused is throwing off our linter (check npm run lint in the repo; npm run fix:js might help)

@deilv
Copy link
Contributor Author

deilv commented Mar 30, 2018

@kfranqueiro I have fixed the linting issues as requested, but I amended the original commit instead of making a second one. I hope that’s alright.

Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It occurs to me that we should probably also be removing the FG_ACTIVATION class within destroy now to cover the case where this timeout is canceled (which normally removes the class)... would you be willing to add that and add a test next to the current destroy css class tests?

Also, have you already confirmed for yourself that these changes resolve your issue when using RMWC?

@deilv
Copy link
Contributor Author

deilv commented Apr 2, 2018

@kfranqueiro I assumed that since the component is destroyed, all relevant classes will be removed with the node. The error was caused by the timeout callback trying to remove the classes from a node that is no longer there. I will look into this and submit a new commit.

I have personally confirmed that this PR solves the issue.

@deilv deilv changed the title fix(ripple): Cancel the activation timer when destroyed (#2460) fix(ripple): Clean activation timer and css when interrupted (#2460) Apr 3, 2018
@deilv
Copy link
Contributor Author

deilv commented Apr 3, 2018

New commit submitted, includes removal of FG_ACTIVATION classes and relevant tests.
Build, lint and unit tests pass.

@kfranqueiro kfranqueiro merged commit 18cba98 into material-components:master Apr 3, 2018
@kfranqueiro
Copy link
Contributor

Thanks for working on this. FYI, it looks like you worked directly on your master branch; because we squash and merge when accepting PRs, you'll need to fetch our repo and hard-reset your fork's master branch to match the main repo's history again.

Assuming you have the main repo's remote added as upstream and you're on your master branch:

git fetch -p upstream
git reset --hard upstream/master
git push -f origin master

I'd recommend creating new branches for PRs in the future for easier development flow.

@deilv
Copy link
Contributor Author

deilv commented Apr 3, 2018

You're welcome. I'm just happy to do my part.
I should have created a separate branch for this issue and work there, I know, but I was multitasking at the time and didn't notice it until much later. I'll reset/rebase my master rep.
Thank you.

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.

4 participants