@live-change/dao-vue3 0.8.13 → 0.8.15
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 +12 -6
- package/package.json +3 -3
package/lib/live.js
CHANGED
|
@@ -77,7 +77,8 @@ async function fetch(api, path) {
|
|
|
77
77
|
}
|
|
78
78
|
return ref(data)
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
const object = createObject(path.what, path.more)
|
|
81
|
+
return object
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
async function live(api, path, onUnmountedCb) {
|
|
@@ -87,6 +88,7 @@ async function live(api, path, onUnmountedCb) {
|
|
|
87
88
|
debug("FETCH", path.value)
|
|
88
89
|
const data = path.value ? await fetch(api, path.value) : ref(null)
|
|
89
90
|
debug("FETCHED", data)
|
|
91
|
+
await new Promise(resolve => process.nextTick(resolve))
|
|
90
92
|
return data
|
|
91
93
|
}
|
|
92
94
|
let liveRef = shallowRef()
|
|
@@ -95,7 +97,7 @@ async function live(api, path, onUnmountedCb) {
|
|
|
95
97
|
let updatePromise = null
|
|
96
98
|
async function update() {
|
|
97
99
|
const newPath = path.value
|
|
98
|
-
if(JSON.stringify(newPath)
|
|
100
|
+
if(JSON.stringify(newPath) === oldPath) return
|
|
99
101
|
if(!updatePromise) updatePromise = (async () => {
|
|
100
102
|
const newUnmountedCallbacks = []
|
|
101
103
|
let newLive = null
|
|
@@ -126,7 +128,11 @@ async function live(api, path, onUnmountedCb) {
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
|
|
129
|
-
if(typeof window == 'undefined')
|
|
131
|
+
if(typeof window == 'undefined') {
|
|
132
|
+
const result = await fetch(api, path)
|
|
133
|
+
await new Promise(resolve => process.nextTick(resolve))
|
|
134
|
+
return result
|
|
135
|
+
}
|
|
130
136
|
if(Array.isArray(path)) path = { what: path }
|
|
131
137
|
const paths = [ path ]
|
|
132
138
|
const preFetchPaths = api.observable({ paths })
|
|
@@ -159,7 +165,7 @@ async function live(api, path, onUnmountedCb) {
|
|
|
159
165
|
function computePointers() {
|
|
160
166
|
while(true) {
|
|
161
167
|
const pointers = collectPointers(newElement, moreElement.schema, getSource)
|
|
162
|
-
if(requiredSrcs.length
|
|
168
|
+
if(requiredSrcs.length === 0) return pointers
|
|
163
169
|
for(const requiredSrc of requiredSrcs) {
|
|
164
170
|
const observable = api.observable(requiredSrc)
|
|
165
171
|
const observer = () => {
|
|
@@ -185,8 +191,8 @@ async function live(api, path, onUnmountedCb) {
|
|
|
185
191
|
extendedElement[moreElement.to] = newArray
|
|
186
192
|
} else if(pointers.length > 0) {
|
|
187
193
|
const oldBound = prop.bounds
|
|
188
|
-
if(!oldBound || oldBound.length
|
|
189
|
-
JSON.stringify(oldBound[0].what)
|
|
194
|
+
if(!oldBound || oldBound.length === 0 ||
|
|
195
|
+
JSON.stringify(oldBound[0].what) !== JSON.stringify(pointers[0])) {
|
|
190
196
|
if(oldBound) {
|
|
191
197
|
prop.bounds.forEach(b => b.dispose())
|
|
192
198
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/dao-vue3",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.15",
|
|
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.8.
|
|
13
|
+
"@live-change/dao": "^0.8.15"
|
|
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": "4897eefbf3ce9ace57630127da89503c71114563"
|
|
36
36
|
}
|