Просмотр исходного кода

Merge pull request #2882 from moonmoonCL/fix/2.38.3-memoryleak

fix: cleartimeout memory leak (#1785)
SudoUser 6 месяцев назад
Родитель
Сommit
2574af20ba

+ 3 - 1
packages/semi-foundation/navigation/subNavFoundation.ts

@@ -52,7 +52,9 @@ export default class SubNavFoundation<P = Record<string, any>, S = Record<string
         this._timer = null;
     }
 
-    destroy() {} // eslint-disable-line
+    destroy() {
+        this.clearDelayTimer();
+    }
 
     clearDelayTimer() {
         if (this._timer) {

+ 1 - 0
packages/semi-foundation/tooltip/foundation.ts

@@ -115,6 +115,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
         this._adapter.unregisterClickOutsideHandler();
         this.unBindResizeEvent();
         this.unBindScrollEvent();
+        clearTimeout(this._timer);
     }
 
     _bindTriggerEvent(triggerEventSet: Record<string, any>) {