From 4a825cec8891ab93ea2ab8f3120cd2b15e9aefa7 Mon Sep 17 00:00:00 2001 From: huangxuan Date: Tue, 2 Apr 2024 11:02:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(inulax):=20=E4=BF=AE=E5=A4=8D=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=AE=A1=E7=90=86=E5=99=A8=E8=A7=A6=E5=8F=91=E7=B1=BB?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=87=8D=E6=96=B0=E6=B8=B2=E6=9F=93=EF=BC=8C?= =?UTF-8?q?shouldComponentUpdate=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/inula/src/renderer/render/ClassComponent.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/inula/src/renderer/render/ClassComponent.ts b/packages/inula/src/renderer/render/ClassComponent.ts index 2792425c..ec1a4857 100644 --- a/packages/inula/src/renderer/render/ClassComponent.ts +++ b/packages/inula/src/renderer/render/ClassComponent.ts @@ -145,7 +145,12 @@ export function captureRender(processing: VNode): VNode | null { processUpdates(processing, inst, nextProps); // 如果 props, state, context 都没有变化且 isForceUpdate 为 false则不需要更新 - shouldUpdate = oldProps !== processing.props || inst.state !== processing.state || processing.isForceUpdate; + shouldUpdate = + oldProps !== processing.props || + inst.state !== processing.state || + processing.isForceUpdate || + // 响应式状态管理器中的值变化,需要更新 + processing.isStoreChange; if (shouldUpdate) { // derivedStateFromProps会修改nextState,因此需要调用 @@ -167,7 +172,7 @@ export function captureRender(processing: VNode): VNode | null { } // 如果捕获了 error,必须更新 const isCatchError = (processing.flags & DidCapture) === DidCapture; - shouldUpdate = isCatchError || shouldUpdate || processing.isStoreChange; + shouldUpdate = isCatchError || shouldUpdate; // 更新ref markRef(processing);