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

fix(md-tooltip): removed watcher for performance #4441

Closed
wants to merge 4 commits into from

Conversation

clshortfuse
Copy link
Contributor

md-tooltip uses a watcher per tooltip. The watcher is just to watch if scope.visible changes. This variable only changes internally so there's no reason to need a watcher when the changes could be tracked manually.

fixes #4033

md-tooltip uses a watcher per tooltip. The watcher is just to watch if scope.visible changes. This variable only changes internally so there's no reason to need a watcher when the changes could be tracked manually.

fixes angular#4033
@clshortfuse
Copy link
Contributor Author

Okay. I see the issue. md-visible can change scope.visible from the outside. I was wrong to assume that .visible as just an internal value. That's really the only issue left.

I'm going to make the changes with MutationObserver and fallback to $watch if MutationObserver isn't supported. I'll do that in a few hours.

scope.visible = false;
if (scope.visible !== false) {
scope.visible = false;
$mdUtil.nextTick(checkVisibility);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you waiting a frame and then calling hideTooltip when the scope has been destroyed?

@ThomasBurleson
Copy link
Contributor

@clshortfuse - please provide 2-n it(...) tests that validate these changes.

@ThomasBurleson ThomasBurleson added in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs needs: review This PR is waiting on review from the team labels Sep 6, 2015
@ThomasBurleson ThomasBurleson added this to the 0.12.0 milestone Sep 6, 2015
@clshortfuse
Copy link
Contributor Author

That was me trying to exactly replicate the $watch behavior trying to figure out why the tests failed. Then I realized it was because md-visible.

@ThomasBurleson
Copy link
Contributor

@clshortfuse - should I close this PR without trying merge? If no, then please squash and rebase.

@clshortfuse
Copy link
Contributor Author

It's not right and buggy. I'll have to revisit it another day. For now, I'll close it.

@clshortfuse clshortfuse closed this Oct 8, 2015
@ThomasBurleson ThomasBurleson removed the in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs label Jan 19, 2016
@Splaktar Splaktar added the needs: unit tests This PR needs unit tests to cover the changes being proposed label Mar 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: review This PR is waiting on review from the team needs: unit tests This PR needs unit tests to cover the changes being proposed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(perf)md-tooltip uses angular watcher per item
3 participants