Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix(progressCircular): rAF is still running when using ng-show or ng-hide #10745

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

Conversation

feichao
Copy link

@feichao feichao commented Jun 16, 2017

fix(progressCircular): requestAnimationFrame is still running when using ng-show or ng-hide #10668

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. 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, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@googlebot googlebot added the cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ label Jun 16, 2017
@feichao
Copy link
Author

feichao commented Jun 16, 2017

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ and removed cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ labels Jun 16, 2017
@ThomasBurleson
Copy link
Contributor

@feichao - lgtm, thx.

@clshortfuse
Copy link
Contributor

Looks rather expensive to evaluate DOM attributes on every Angular tick. MutationObserver would give better performance.

Also, using ng-if instead of ng-show would solve the underlying issue, so a recommendation could be added in the documentation. Another alternative would be to only use the watcher if ng-show or ng-hide are being used.

@ThomasBurleson ThomasBurleson modified the milestones: 1.1.6, 1.1.5 Aug 3, 2017
@Splaktar Splaktar changed the title fix(progressCircular): requestAnimationFrame is still running when us… fix(progressCircular): rAF is still running when using ng-show or ng-hide Nov 18, 2017
@Splaktar
Copy link
Member

@clshortfuse any ideas on how to use the watcher only when ng-show or ng-hide are being used?

@feichao can you please add some tests for this?
For example: Verify that the md-mode-indeterminate is applied after the element is displayed via toggling ng-show and verify that the md-mode-indeterminate is removed after the element is hidden via toggling ng-hide.

@clshortfuse
Copy link
Contributor

clshortfuse commented Nov 20, 2017

@Splaktar Sure, you can use a MutationObserver to watch for the ng-show or ng-hide class. If the value exists then a watcher should be created to handle its computed value.

You can see a similar implementation created with md-visible with md-tooltip in #7822

@angular angular deleted a comment from googlebot Nov 21, 2017
@angular angular deleted a comment from googlebot Nov 21, 2017
@Splaktar
Copy link
Member

Splaktar commented Nov 21, 2017

@feichao Thank you very much for your contribution! Can you please update your implementation to only apply the watcher when ng-show or ng-hide are present as described in #10745 (comment)?

Since this whole PR is about performance, it would be best to use this more optimally performing approach.

@Splaktar Splaktar added needs: tests type: performance This issue is related to performance in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs and removed in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs needs: work labels Nov 21, 2017
@Splaktar Splaktar modified the milestones: 1.1.6, 1.1.7 Jan 17, 2018
@Splaktar
Copy link
Member

We'll need to make sure that the MutationObserver has a fallback since we'll need to do something else on IE10.

@Splaktar Splaktar modified the milestones: 1.1.7, - Backlog Jan 30, 2018
@Splaktar Splaktar added needs: unit tests This PR needs unit tests to cover the changes being proposed and removed needs: tests labels Mar 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs needs: unit tests This PR needs unit tests to cover the changes being proposed type: performance This issue is related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants