diff --git a/src/factory.tsx b/src/factory.tsx index 50a6ee210..99bba1461 100644 --- a/src/factory.tsx +++ b/src/factory.tsx @@ -304,7 +304,7 @@ export function renderChild( props.hidden || props.visible === false) ) { - return (<>); + return null; } const transform = props.propsTransform; diff --git a/src/renderers/Form/Combo.tsx b/src/renderers/Form/Combo.tsx index 9236c6f26..ec91cf734 100644 --- a/src/renderers/Form/Combo.tsx +++ b/src/renderers/Form/Combo.tsx @@ -23,6 +23,7 @@ import {isEffectiveApi} from '../../utils/api'; import {Alert2} from '../../components'; import memoize from 'lodash/memoize'; import {Icon} from '../../components/icons'; +import {isAlive} from 'mobx-state-tree'; export interface Condition { test: string; controls: Array; @@ -382,8 +383,10 @@ export default class ComboControl extends React.Component { this.props.onChange(value, submitOnChange, true); - store.forms.forEach(item => - item.items.forEach(item => item.unique && item.syncOptions()) + store.forms.forEach( + item => + isAlive(item) && + item.items.forEach(item => item.unique && item.syncOptions()) ); } diff --git a/src/renderers/Form/Service.tsx b/src/renderers/Form/Service.tsx index c483e44bd..3226fc427 100644 --- a/src/renderers/Form/Service.tsx +++ b/src/renderers/Form/Service.tsx @@ -7,6 +7,7 @@ import Scoped, {ScopedContext, IScopedContext} from '../../Scoped'; import {observer} from 'mobx-react'; import {ServiceStore, IServiceStore} from '../../store/service'; import {IFormStore} from '../../store/form'; +import {isObject} from '../../utils/helper'; @Renderer({ test: /(^|\/)form\/(.*)\/service$/, @@ -59,7 +60,7 @@ export class ServiceRenderer extends BasicService { // 有可能有很多层 serivce,这里需要注意。 if (formStore && this.isFormMode()) { - const keys = Object.keys(payload.data); + const keys = isObject(payload?.data) ? Object.keys(payload.data) : []; if (keys.length) { formStore.setValues(payload.data);