From 1cc4be45ead22fc7cb641671fb6dfcfae60f685f Mon Sep 17 00:00:00 2001 From: sidrong <529672493@qq.com> Date: Tue, 23 Apr 2024 15:37:04 +0800 Subject: [PATCH] Update Form.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改dispatchInited方法,主要解决:当跳转到包含Form的新页面,新页面还没加载完成时,快速后退导致的报错:Uncaught (in promise) Error: [mobx-state-tree] You are trying to read or write to an object that is no longer part of a state tree. --- packages/amis-core/src/renderers/Form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amis-core/src/renderers/Form.tsx b/packages/amis-core/src/renderers/Form.tsx index ef49890e4..37aac8079 100644 --- a/packages/amis-core/src/renderers/Form.tsx +++ b/packages/amis-core/src/renderers/Form.tsx @@ -713,7 +713,7 @@ export default class Form extends React.Component { async dispatchInited(value: any) { const {data, store, dispatchEvent} = this.props; - if (store.fetching) { + if (!isAlive(store) || store.fetching) { return value; }