Merge branch 'fix-Promise.allSettled' into 'release/1.0.0'

Fix promise.all settled



See merge request !1060540
This commit is contained in:
荣彬 2020-11-25 20:01:44 +08:00
commit ff647f6f26
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-datasource-engine",
"version": "1.0.22",
"version": "1.0.23-alpha.1",
"description": "DataSource Engine for lowcode",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
@ -19,10 +19,12 @@
"dependencies": {
"@ali/lowcode-datasource-types": "^1.0.21",
"@ali/lowcode-types": "^1.0.20",
"promise.allsettled": "^1.0.2",
"typescript": "^3.9.7"
},
"devDependencies": {
"@ava/babel": "^1.0.1",
"@types/promise.allsettled": "^1.0.3",
"@types/sinon": "^9.0.5",
"ava": "3.11.1",
"get-port": "^5.1.1",

View File

@ -1,4 +1,8 @@
import { DataSourceMap, RuntimeDataSource, RuntimeDataSourceConfig } from '@ali/lowcode-types';
import allSettled from 'promise.allsettled';
// 兼容低版本的浏览器
const promiseSettled = typeof Promise.allSettled === 'function' ? Promise.allSettled : allSettled;
export const reloadDataSourceFactory = (
dataSource: RuntimeDataSource,
@ -56,7 +60,7 @@ export const reloadDataSourceFactory = (
}
}
await Promise.allSettled(allAsyncLoadings);
await promiseSettled(allAsyncLoadings);
// 所有的初始化请求都结束之后,调用钩子函数