-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Fixed: TypeError: Cannot read property 'offsetHeight' of null #6226
Conversation
If the tooltip is hidden before the timeout resolves, an exception is created. Fix is the cancel the timeout when the tooltip is hidden
Hi, great to see there's a fix candidate. Any idea when this will be merged and distributed via a new bower package? |
Same here, but we use |
@Johnnyrook777 : Hello, did you try your fix against this Plunk : http://embed.plnkr.co/P6bLrajSHzkTdftcMHTw/ Just to be sure there is no race conditions deeper with $destroy. |
@@ -315,6 +317,11 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s | |||
$timeout.cancel(transitionTimeout); | |||
transitionTimeout = null; | |||
} | |||
|
|||
if (positionTimeout) { |
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.
Don't we want to keep it if the hide is canceled?
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.
This was something I added thinking there was may be a left over timeout and potential memory leak
However, it isn't actually part of the issue, and was more of a memory tweak.
Although it didn't cause issues in my scenario, it probably requires more testing
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.
I took another look at this. The error happens when the tooltip is positioned or adjusted, but the DOM has been destroyed/unloaded somehow (For me occurring during a route change)
I suspect this timeout should be cancelled as well as the DOM is definitely gone, so this position code has nothing to run on anyway
Either way, this error is hugely timing dependant
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.
Actually. Thought about this more on the way home. I suspect this condition could never occur, and there are no reports of it happening. Don't change what isn't broke
I'll update this tomorrow and remove this
Made the change locally, merging shortly. |
If the tooltip is hidden before the timeout resolves, an exception is created. #6221
Fix is to cancel the timeout when the tooltip is hidden