@budibase/frontend-core 2.32.17 → 2.33.0

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.
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.32.17",
3
+ "version": "2.33.0",
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.32.17",
10
- "@budibase/shared-core": "2.32.17",
11
- "@budibase/types": "2.32.17",
9
+ "@budibase/bbui": "2.33.0",
10
+ "@budibase/shared-core": "2.33.0",
11
+ "@budibase/types": "2.33.0",
12
12
  "dayjs": "^1.10.8",
13
13
  "lodash": "4.17.21",
14
14
  "shortid": "2.2.15",
15
15
  "socket.io-client": "^4.7.5"
16
16
  },
17
- "gitHead": "6fcb7de554b4b5f46c070b9a4afdaaf4360f1d9a"
17
+ "gitHead": "d2e847e01338828b8c79edf99071c9d2cc48ea39"
18
18
  }
@@ -2,36 +2,31 @@
2
2
  export let isMigrationDone
3
3
  export let onMigrationDone
4
4
  export let timeoutSeconds = 60 // 1 minute
5
- export let minTimeSeconds = 3
6
5
 
7
- const loadTime = Date.now()
8
- const intervalMs = 1000
9
6
  let timedOut = false
10
- let secondsWaited = 0
11
7
 
12
8
  async function checkMigrationsFinished() {
13
- setTimeout(async () => {
14
- const isMigrated = await isMigrationDone()
15
-
16
- const timeoutMs = timeoutSeconds * 1000
17
- if (!isMigrated || secondsWaited <= minTimeSeconds) {
18
- if (loadTime + timeoutMs > Date.now()) {
19
- secondsWaited += 1
20
- return checkMigrationsFinished()
21
- }
9
+ let totalWaitMs = 0
10
+ // eslint-disable-next-line no-constant-condition
11
+ while (true) {
12
+ const waitForMs = 5000 + Math.random() * 5000
13
+ await new Promise(resolve => setTimeout(resolve, waitForMs))
14
+ totalWaitMs += waitForMs
22
15
 
23
- return migrationTimeout()
16
+ const isMigrated = await isMigrationDone()
17
+ if (isMigrated) {
18
+ onMigrationDone()
19
+ return
24
20
  }
25
21
 
26
- onMigrationDone()
27
- }, intervalMs)
22
+ if (totalWaitMs > timeoutSeconds * 1000) {
23
+ timedOut = true
24
+ return
25
+ }
26
+ }
28
27
  }
29
28
 
30
29
  checkMigrationsFinished()
31
-
32
- function migrationTimeout() {
33
- timedOut = true
34
- }
35
30
  </script>
36
31
 
37
32
  <div class="loading" class:timeout={timedOut}>