From 9a2f3fd2e3f9c324a1ee1296707dab5942811d2c Mon Sep 17 00:00:00 2001 From: jian Date: Tue, 19 Dec 2023 16:45:16 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-16950=20fix:=20=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=BA=9Blog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/4.widget.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/fineui/src/core/4.widget.js b/packages/fineui/src/core/4.widget.js index 8fe60098a..9bf69e4a3 100644 --- a/packages/fineui/src/core/4.widget.js +++ b/packages/fineui/src/core/4.widget.js @@ -240,11 +240,9 @@ export class Widget extends OB { ).call(this, render); if (beforeRenderResult instanceof Promise) { beforeRenderResult.then(render).catch((e) => { - if (!this.isDestroyed()) { - render(); // 异步render,组件此时可能已经被销毁 - } else { - _global.console && console.error(e, 'Async render error! Widget has been destroyed!'); - } + _global.console && console.error(e); + // 异步render,组件此时可能已经被销毁 + !this.isDestroyed() ? render() : _global.console && console.error('Async render error! Widget has been destroyed!'); }); } } else { @@ -260,11 +258,9 @@ export class Widget extends OB { ).call(this, init); if (beforeInitResult instanceof Promise) { beforeInitResult.then(init).catch((e) => { - if (!this.isDestroyed()) { - init(); // 异步init,组件此时可能已经被销毁 - } else { - _global.console && console.error(e, 'Async init error! Widget has been destroyed!'); - } + _global.console && console.error(e); + // 异步init,组件此时可能已经被销毁 + !this.isDestroyed() ? init() : _global.console && console.error('Async init error! Widget has been destroyed!'); }); } } else {