删除不必要的isEffctiveApi

This commit is contained in:
catchonme 2019-07-11 20:04:05 +08:00
parent 2f39ea2148
commit 85b38a2016
3 changed files with 10 additions and 18 deletions

View File

@ -272,10 +272,7 @@ export default class Form extends React.Component<FormProps, object> {
const props = this.props;
const store = props.store;
if (
isApiOutdated(prevProps.initApi, props.initApi, prevProps.data, props.data) &&
isEffectiveApi(props.initApi, props.data)
) {
if (isApiOutdated(prevProps.initApi, props.initApi, prevProps.data, props.data)) {
const {
fetchSuccess,
fetchFailed,

View File

@ -88,19 +88,17 @@ export default class Service extends React.Component<ServiceProps> {
}
} = props;
isApiOutdated(prevProps.api, props.api, prevProps.data, props.data) &&
isEffectiveApi(props.api, props.data) &&
store.fetchData(props.api as Api, store.data, {
isApiOutdated(prevProps.api, props.api, prevProps.data, props.data)
store.fetchData(props.api as Api, store.data, {
successMessage: fetchSuccess,
errorMessage: fetchFailed
}).then(this.initInterval);
isApiOutdated(prevProps.schemaApi, props.schemaApi, prevProps.data, props.data) &&
store.fetchSchema(props.schemaApi as Api, store.data, {
successMessage: fetchSuccess,
errorMessage: fetchFailed
}).then(this.initInterval);
isApiOutdated(prevProps.schemaApi, props.schemaApi, prevProps.data, props.data) &&
isEffectiveApi(props.schemaApi, props.data) &&
store.fetchSchema(props.schemaApi as Api, store.data, {
successMessage: fetchSuccess,
errorMessage: fetchFailed
}).then(this.initInterval);
}
componentWillUnmount() {

View File

@ -146,10 +146,7 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
const props = this.props;
const {store, fetchSuccess, fetchFailed} = props;
if (
isApiOutdated(prevProps.initApi, props.initApi, prevProps.data, props.data) &&
isEffectiveApi(props.initApi, props.data)
) {
if (isApiOutdated(prevProps.initApi, props.initApi, prevProps.data, props.data)) {
store.fetchData(props.initApi, store.data, {
successMessage: fetchSuccess,
errorMessage: fetchFailed,