diff --git a/package.json b/package.json index 7cc11b3ea..f20ff120d 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,6 @@ "jest": { "verbose": true, "testEnvironment": "jsdom", - "collectCoverage": true, "coverageReporters": [ "text", "cobertura" diff --git a/packages/amis-core/src/renderers/Form.tsx b/packages/amis-core/src/renderers/Form.tsx index 531fa11e1..fc7addd07 100644 --- a/packages/amis-core/src/renderers/Form.tsx +++ b/packages/amis-core/src/renderers/Form.tsx @@ -661,7 +661,7 @@ export default class Form extends React.Component { const {data, store, dispatchEvent} = this.props; if (store.fetching) { - return; + return value; } // 派发init事件,参数为初始化数据 @@ -810,7 +810,8 @@ export default class Form extends React.Component { const {interval, silentPolling, stopAutoRefreshWhen, data} = this.props; clearTimeout(this.timer); - interval && + value?.ok && + interval && this.mounted && (!stopAutoRefreshWhen || !evalExpression(stopAutoRefreshWhen, data)) && (this.timer = setTimeout( diff --git a/packages/amis/src/renderers/CRUD.tsx b/packages/amis/src/renderers/CRUD.tsx index 1a56d695c..91d6ef3ed 100644 --- a/packages/amis/src/renderers/CRUD.tsx +++ b/packages/amis/src/renderers/CRUD.tsx @@ -1245,7 +1245,8 @@ export default class CRUD extends React.Component { ); } - interval && + value?.ok && // 接口正常返回才继续轮训 + interval && this.mounted && (!stopAutoRefreshWhen || !( diff --git a/packages/amis/src/renderers/CRUD2.tsx b/packages/amis/src/renderers/CRUD2.tsx index 2c5d176cf..2d166cb4f 100644 --- a/packages/amis/src/renderers/CRUD2.tsx +++ b/packages/amis/src/renderers/CRUD2.tsx @@ -579,7 +579,8 @@ export default class CRUD2 extends React.Component { isTable2: true }) .then(value => { - interval && + value?.ok && // 接口正常返回才继续轮训 + interval && !this.stopingAutoRefresh && this.mounted && (!stopAutoRefreshWhen || diff --git a/packages/amis/src/renderers/Page.tsx b/packages/amis/src/renderers/Page.tsx index 8e6ec0992..66b5ae37c 100644 --- a/packages/amis/src/renderers/Page.tsx +++ b/packages/amis/src/renderers/Page.tsx @@ -701,7 +701,8 @@ export default class Page extends React.Component { }) ); - interval && + value?.ok && // 接口正常返回才继续轮训 + interval && this.mounted && (!stopAutoRefreshWhen || !evalExpression(stopAutoRefreshWhen, data)) && (this.timer = setTimeout( diff --git a/packages/amis/src/renderers/Service.tsx b/packages/amis/src/renderers/Service.tsx index ce19ad7a6..cce3b4c0e 100644 --- a/packages/amis/src/renderers/Service.tsx +++ b/packages/amis/src/renderers/Service.tsx @@ -531,7 +531,7 @@ export default class Service extends React.Component { onBulkChange(data); } - this.initInterval(data); + result?.ok && this.initInterval(data); } afterSchemaFetch(schema: any) {