@live-change/dao-vue3 0.5.5 → 0.5.7

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/lib/live.js +9 -4
  2. package/package.json +3 -3
package/lib/live.js CHANGED
@@ -32,6 +32,7 @@ async function fetch(api, path) {
32
32
  const preFetchMap = new Map(preFetchPaths.map((res) => [JSON.stringify(res.what), res] ))
33
33
  function createObject(what, more) {
34
34
  const res = preFetchMap.get(JSON.stringify(what))
35
+ console.log("PREFETCH", what, "RES", res, "MORE", more)
35
36
  if(res.error) throw new Error(res.error)
36
37
  const data = res.data
37
38
  if(data && more) {
@@ -76,7 +77,12 @@ async function fetch(api, path) {
76
77
 
77
78
  async function live(api, path, onUnmountedCb) {
78
79
  if(isRef(path)) {
79
- if(typeof window == 'undefined') return fetch(api, path.value)
80
+ if(typeof window == 'undefined') {
81
+ console.log("FETCH", path.value)
82
+ const data = await fetch(api, path.value)
83
+ console.log("FETCHED", data)
84
+ return data
85
+ }
80
86
  let liveRef = shallowRef()
81
87
  let onUnmountedCallbacks = []
82
88
  let oldPath = null
@@ -94,8 +100,8 @@ async function live(api, path, onUnmountedCb) {
94
100
  liveRef.value = newLive
95
101
  onUnmountedCallbacks = newUnmountedCallbacks
96
102
  oldPath = JSON.stringify(newPath)
97
- })()
98
- await updatePromise
103
+ })().then(() => updatePromise = null)
104
+ if(updatePromise) await updatePromise
99
105
  await update()
100
106
  }
101
107
  await update()
@@ -266,7 +272,6 @@ async function live(api, path, onUnmountedCb) {
266
272
  await new Promise((resolve) => setTimeout(resolve, 0))
267
273
  }
268
274
  return resultRef
269
-
270
275
  }
271
276
 
272
277
  export default live
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/dao-vue3",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
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-dao/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@live-change/dao": "^0.5.5"
13
+ "@live-change/dao": "^0.5.7"
14
14
  },
15
15
  "description": "Vue.js integration for live-change dao",
16
16
  "directories": {},
@@ -32,5 +32,5 @@
32
32
  "scripts": {
33
33
  "compileTests": "webpack test/*.js tests-bundle.js"
34
34
  },
35
- "gitHead": "eae674e3ac5cc7b7fb58c9a3b31bb038dc6538e9"
35
+ "gitHead": "53cd3536a135bdfd31edc75538a3ea5a426d307e"
36
36
  }