-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(md-tooltip): removed watcher for performance #4441
Conversation
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
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); |
There was a problem hiding this comment.
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?
@clshortfuse - please provide 2-n |
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. |
@clshortfuse - should I close this PR without trying merge? If no, then please squash and rebase. |
It's not right and buggy. I'll have to revisit it another day. For now, I'll close it. |
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