fix Tooltip component complete handlers [#37474]

* ensure `complete` handlers for `show` and `hide` check if the commponent was disposed
* what can happen is the element can get removed from the DOM and the tooltip would get disposed
* when the complete handler would run at a later point the component would be disposed and would throw various null related exceptions
This commit is contained in:
Vadim Kazakov 2024-09-19 10:22:15 -06:00
parent 523493d096
commit 666a3ae53d
1 changed files with 10 additions and 0 deletions

View File

@ -227,6 +227,11 @@ class Tooltip extends BaseComponent {
}
const complete = () => {
// component disposed
if (!this._element) {
return
}
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN))
if (this._isHovered === false) {
@ -266,6 +271,11 @@ class Tooltip extends BaseComponent {
this._isHovered = null // it is a trick to support manual triggering
const complete = () => {
// component disposed
if (!this._element) {
return
}
if (this._isWithActiveTrigger()) {
return
}