@live-change/dao-vue3 0.9.18 → 0.9.20
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/lib/live.js +15 -8
- package/package.json +3 -3
package/lib/live.js
CHANGED
|
@@ -49,7 +49,7 @@ async function fetch(api, path) {
|
|
|
49
49
|
+ '\n when fetching '+JSON.stringify(what) + ' with more=('+JSON.stringify(more)+')'
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
|
-
const data = res.data
|
|
52
|
+
const data = JSON.parse(JSON.stringify(res.data))
|
|
53
53
|
if(data && more) {
|
|
54
54
|
if(Array.isArray(data)) {
|
|
55
55
|
for(let i = 0; i < data.length; i ++) {
|
|
@@ -277,27 +277,34 @@ async function live(api, path, onUnmountedCb) {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
const resultRef = ref()
|
|
280
|
+
let error = null
|
|
280
281
|
await new Promise((resolve, reject) => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
console.error("LIVE ERROR", msg, 'WHILE FETCHING', path)
|
|
284
|
-
if(error) return
|
|
282
|
+
const onBindError = (msg) => {
|
|
283
|
+
console.error("LIVE BIND ERROR", msg, 'WHILE FETCHING', path)
|
|
285
284
|
error = msg
|
|
286
|
-
reject(error)
|
|
285
|
+
//reject(error)
|
|
287
286
|
}
|
|
288
|
-
const
|
|
287
|
+
const onResolveError = (msg) => {
|
|
288
|
+
console.error("LIVE RESOLVE ERROR", msg, 'WHILE FETCHING', path)
|
|
289
|
+
error = msg
|
|
290
|
+
//reject(error)
|
|
291
|
+
}
|
|
292
|
+
const bound = bindResult(path.what, path.more, path.actions, resultRef, 'value', onBindError)
|
|
289
293
|
const pathsObserver = (signal, value) => {}
|
|
290
294
|
preFetchPaths.observe(pathsObserver)
|
|
291
295
|
onUnmountedCb(() => {
|
|
292
296
|
preFetchPaths.unobserve(pathsObserver)
|
|
293
297
|
bound.dispose()
|
|
294
298
|
})
|
|
295
|
-
preFetchPaths.wait().then(
|
|
299
|
+
preFetchPaths.wait().then((v) => {
|
|
300
|
+
resolve(v)
|
|
301
|
+
}).catch(onResolveError)
|
|
296
302
|
})
|
|
297
303
|
while(fetchPromises.length > 0) { // wait for all fetch promises, including ones added by bindResult
|
|
298
304
|
await fetchPromises.shift()
|
|
299
305
|
}
|
|
300
306
|
while(unref(resultRef) === undefined) { // wait for next tick
|
|
307
|
+
if(error) throw new Error(error)
|
|
301
308
|
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
302
309
|
}
|
|
303
310
|
return resultRef
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/dao-vue3",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.20",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "m8@em8.pl",
|
|
6
6
|
"name": "Michał Łaszczewski",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/live-change/live-change-stack/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@live-change/dao": "^0.9.
|
|
13
|
+
"@live-change/dao": "^0.9.20"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"description": "Vue.js integration for live-change dao",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"compileTests": "webpack test/*.js tests-bundle.js"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "6524c2dedbb137e95e9aa07eaf9503d68d7b9093"
|
|
36
36
|
}
|