From 7b125bb4f67062f80db91d05330ffa0000b2a3f6 Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Thu, 26 Dec 2019 15:39:37 +0800 Subject: [PATCH] =?UTF-8?q?remove=20=E5=89=8D=E5=85=88=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=B7=B2=E7=BB=8Fdestroy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/index.tsx | 3 ++- src/store/combo.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderers/Form/index.tsx b/src/renderers/Form/index.tsx index c3086940..d07bb595 100644 --- a/src/renderers/Form/index.tsx +++ b/src/renderers/Form/index.tsx @@ -32,6 +32,7 @@ import {dataMapping} from '../../utils/tpl-builtin'; import {isApiOutdated, isEffectiveApi} from '../../utils/api'; import Spinner from '../../components/Spinner'; import {LazyComponent} from '../../components'; +import {isAlive} from 'mobx-state-tree'; export type FormGroup = FormSchema & { title?: string; className?: string; @@ -320,7 +321,7 @@ export default class Form extends React.Component { store.parentStore.storeType === 'ComboStore' ) { const combo = store.parentStore as IComboStore; - combo.removeForm(store); + isAlive(combo) && combo.removeForm(store); } } diff --git a/src/store/combo.ts b/src/store/combo.ts index fb147f9e..38f259ed 100644 --- a/src/store/combo.ts +++ b/src/store/combo.ts @@ -1,4 +1,4 @@ -import {types, SnapshotIn} from 'mobx-state-tree'; +import {types, SnapshotIn, isAlive} from 'mobx-state-tree'; import {iRendererStore} from './iRenderer'; import {FormItemStore, IFormItemStore} from './formItem'; import {FormStore, IFormStore} from './form';