remove 前先判断是否已经destroy

This commit is contained in:
2betop 2019-12-26 15:39:37 +08:00
parent aaef9b7952
commit 7b125bb4f6
2 changed files with 3 additions and 2 deletions

View File

@ -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<FormProps, object> {
store.parentStore.storeType === 'ComboStore'
) {
const combo = store.parentStore as IComboStore;
combo.removeForm(store);
isAlive(combo) && combo.removeForm(store);
}
}

View File

@ -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';