From 71c0d6eda9d3dab87d378c2ac70d5c4e1702929e Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Wed, 28 Jun 2023 18:41:38 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=8E=A5=E5=8F=A3=E8=BD=AE=E8=AE=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=99=90=E5=88=B6,=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E8=BF=94=E5=9B=9E=E6=89=8D=E8=BD=AE=E8=AE=AD?= =?UTF-8?q?=20Close:=20#7260=20(#7263)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - packages/amis-core/src/renderers/Form.tsx | 5 +++-- packages/amis/src/renderers/CRUD.tsx | 3 ++- packages/amis/src/renderers/CRUD2.tsx | 3 ++- packages/amis/src/renderers/Page.tsx | 3 ++- packages/amis/src/renderers/Service.tsx | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) 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) {