form init 过程中不要去 diff 参数变化发送请求

This commit is contained in:
2betop 2019-12-26 12:26:10 +08:00
parent 8a34b0d420
commit 53314a4f89
3 changed files with 6 additions and 5 deletions

View File

@ -58,7 +58,7 @@ export default class ChainedSelectControl extends React.Component<
componentDidUpdate(prevProps: ChainedSelectProps) {
const props = this.props;
if (props.value !== prevProps.value) {
if (props.formInited && props.value !== prevProps.value) {
this.loadMore();
}
}

View File

@ -86,8 +86,8 @@ export default class MatrixCheckbox extends React.Component<
rows: nextProps.rows || []
});
} else if (
nextProps.source !== props.source ||
props.data !== nextProps.data
nextProps.formInited &&
(nextProps.source !== props.source || props.data !== nextProps.data)
) {
let prevApi = buildApi(props.source as string, props.data as object, {
ignoreData: true

View File

@ -3,7 +3,7 @@
* ListButtonGroup
*/
import {Api, Schema} from '../../types';
import {isEffectiveApi, isApiOutdated} from '../../utils/api';
import {isEffectiveApi, isApiOutdated, isValidApi} from '../../utils/api';
import {isAlive} from 'mobx-state-tree';
import {
anyChanged,
@ -210,7 +210,7 @@ export function registerOptionsControl(config: OptionsConfig) {
const props = this.props;
const formItem = props.formItem as IFormItemStore;
if (!formItem) {
if (!formItem || !props.formInited) {
return;
} else if (!prevProps.formItem) {
// todo 优化 name 变化情况。
@ -242,6 +242,7 @@ export function registerOptionsControl(config: OptionsConfig) {
prevOptions !== options &&
formItem.setOptions(normalizeOptions(options || []));
} else if (
isEffectiveApi(props.source, props.data) &&
isApiOutdated(
prevProps.source,
props.source,