@budibase/frontend-core 2.0.30-alpha.15 → 2.0.30-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/utils/utils.js +21 -9
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.0.30-alpha.15",
3
+ "version": "2.0.30-alpha.17",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
7
7
  "svelte": "src/index.js",
8
8
  "dependencies": {
9
- "@budibase/bbui": "2.0.30-alpha.15",
9
+ "@budibase/bbui": "2.0.30-alpha.17",
10
10
  "lodash": "^4.17.21",
11
11
  "svelte": "^3.46.2"
12
12
  },
13
- "gitHead": "83d5f70937fc66baa53782da968a06f71ff54d19"
13
+ "gitHead": "d4af1bccac16c2c94be2e5d9864b48021d1a386a"
14
14
  }
@@ -6,17 +6,29 @@
6
6
  */
7
7
  export const sequential = fn => {
8
8
  let queue = []
9
- return async (...params) => {
10
- queue.push(async () => {
11
- await fn(...params)
12
- queue.shift()
13
- if (queue.length) {
14
- await queue[0]()
9
+ return (...params) => {
10
+ return new Promise((resolve, reject) => {
11
+ queue.push(async () => {
12
+ let data, error
13
+ try {
14
+ data = await fn(...params)
15
+ } catch (err) {
16
+ error = err
17
+ }
18
+ queue.shift()
19
+ if (queue.length) {
20
+ queue[0]()
21
+ }
22
+ if (error) {
23
+ reject(error)
24
+ } else {
25
+ resolve(data)
26
+ }
27
+ })
28
+ if (queue.length === 1) {
29
+ queue[0]()
15
30
  }
16
31
  })
17
- if (queue.length === 1) {
18
- await queue[0]()
19
- }
20
32
  }
21
33
  }
22
34