@live-change/dao-vue3 0.9.84 → 0.9.85

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 +11 -4
  2. package/package.json +3 -3
package/lib/live.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ref, onUnmounted, getCurrentInstance, unref, reactive, isRef, shallowRef, watch, computed } from 'vue'
2
- import { collectPointers, ExtendedObservableList } from '@live-change/dao'
2
+ import { collectPointers, ExtendedObservableList, sourceSymbol } from '@live-change/dao'
3
3
  import nodeDebug from 'debug'
4
4
  const debug = nodeDebug('dao-vue3')
5
5
  debug.log = console.log.bind(console)
@@ -29,8 +29,8 @@ async function fetch(api, path) {
29
29
  const paths = [ path ]
30
30
  const preFetchPaths = await api.get({ paths })
31
31
  debug("PRE FETCH DATA", preFetchPaths)
32
- /*console.log("PATHS", paths)
33
- return null*/
32
+ //console.log("PATHS", paths)
33
+ //return null
34
34
  for(const path of preFetchPaths) {
35
35
  if(path.error) {
36
36
  throw new Error(''
@@ -50,6 +50,7 @@ async function fetch(api, path) {
50
50
  )
51
51
  }
52
52
  const data = JSON.parse(JSON.stringify(res.data))
53
+ if(data) data[sourceSymbol] = what
53
54
  if(data && more) {
54
55
  if(Array.isArray(data)) {
55
56
  for(let i = 0; i < data.length; i ++) {
@@ -150,7 +151,10 @@ async function live(api, path, onUnmountedCb) {
150
151
  const fetchPromises = []
151
152
  function bindResult(what, more, actions, object, property, onError) {
152
153
  if(!what) throw new Error("what parameter required!")
153
- const observable = api.observable(what)
154
+ // debugger;
155
+ const observable = api.observable(what)
156
+ /* console.log("OBSERVABLE", JSON.stringify(observable.getValue()), "K", observable.getValue() && Object.keys(observable.getValue()),
157
+ "WHAT", what, "SOURCE", observable.getValue()?.[sourceSymbol]) */
154
158
  const errorObserver = { error: onError }
155
159
  let dispose
156
160
  if((more && more.some(m => m.to)) || actions) {
@@ -250,10 +254,13 @@ async function live(api, path, onUnmountedCb) {
250
254
  if(data && typeof data == 'object') {
251
255
  const activated = reactive(data)
252
256
  return activated
257
+ data[sourceSymbol] = what
253
258
  }
254
259
  return data
255
260
  }
256
261
  )
262
+ const value = extendedObservable.getValue()
263
+ if(value && typeof value == 'object') value[sourceSymbol] = what
257
264
  extendedObservable.bindProperty(object, property)
258
265
  observable.observe(errorObserver)
259
266
  dispose = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/dao-vue3",
3
- "version": "0.9.84",
3
+ "version": "0.9.85",
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.84"
13
+ "@live-change/dao": "^0.9.85"
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": "5881a5406e3a39e673034f172266409ddb306f2e"
35
+ "gitHead": "126afb0aad3ab6e03aa5742726f429c95c46783a"
36
36
  }