@live-change/dao-vue3 0.8.12 → 0.8.14

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 +12 -6
  2. package/package.json +5 -5
package/lib/live.js CHANGED
@@ -77,7 +77,8 @@ async function fetch(api, path) {
77
77
  }
78
78
  return ref(data)
79
79
  }
80
- return createObject(path.what, path.more)
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) == oldPath) return
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') return fetch(api, path)
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 == 0) return pointers
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 == 0 ||
189
- JSON.stringify(oldBound[0].what) != JSON.stringify(pointers[0])) {
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,20 +1,20 @@
1
1
  {
2
2
  "name": "@live-change/dao-vue3",
3
- "version": "0.8.12",
3
+ "version": "0.8.14",
4
4
  "author": {
5
5
  "email": "m8@em8.pl",
6
6
  "name": "Michał Łaszczewski",
7
7
  "url": "http://www.viamage.com/"
8
8
  },
9
9
  "bugs": {
10
- "url": "https://github.com/live-change/live-change-dao/issues"
10
+ "url": "https://github.com/live-change/live-change-stack/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@live-change/dao": "^0.8.12"
13
+ "@live-change/dao": "^0.8.14"
14
14
  },
15
15
  "type": "module",
16
16
  "description": "Vue.js integration for live-change dao",
17
- "homepage": "https://github.com/live-change/live-change-dao",
17
+ "homepage": "https://github.com/live-change/live-change-stack",
18
18
  "license": "BSD-3-Clause",
19
19
  "main": "index.js",
20
20
  "module": "index.js",
@@ -32,5 +32,5 @@
32
32
  "scripts": {
33
33
  "compileTests": "webpack test/*.js tests-bundle.js"
34
34
  },
35
- "gitHead": "5c93162184742550bf6a5e7b37a5537c69f8a3c4"
35
+ "gitHead": "d81b573fb8891746ae1c67f4f68558123c9f85f7"
36
36
  }