@live-change/dao-vue3 0.9.117 → 0.9.119

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 +16 -10
  2. package/package.json +3 -3
package/lib/live.js CHANGED
@@ -95,6 +95,17 @@ async function fetch(api, path) {
95
95
 
96
96
  async function live(api, path, onUnmountedCb) {
97
97
  if(path == null) return ref(null)
98
+
99
+ if(!onUnmountedCb && typeof window != 'undefined') {
100
+ if(getCurrentInstance()) {
101
+ onUnmountedCb = onUnmounted
102
+ } else {
103
+ onUnmountedCb = () => {
104
+ console.error("live fetch outside component instance - possible memory leak")
105
+ }
106
+ }
107
+ }
108
+
98
109
  if(isRef(path)) {
99
110
  if(typeof window == 'undefined') {
100
111
  debug("FETCH", path.value)
@@ -127,17 +138,12 @@ async function live(api, path, onUnmountedCb) {
127
138
  await update()
128
139
  watch(() => path.value, () => update())
129
140
  const result = computed(() => liveRef.value === null ? null : liveRef.value?.value)
130
- return result
131
- }
132
141
 
133
- if(!onUnmountedCb && typeof window != 'undefined') {
134
- if(getCurrentInstance()) {
135
- onUnmountedCb = onUnmounted
136
- } else {
137
- onUnmountedCb = () => {
138
- console.error("live fetch outside component instance - possible memory leak")
139
- }
140
- }
142
+ onUnmountedCb(() => {
143
+ console.log("UNMOUNTED COMPUTED PATH", path.value, "ON UNMOUNTED CALLBACKS", onUnmountedCallbacks)
144
+ for(const callback of onUnmountedCallbacks) callback()
145
+ })
146
+ return result
141
147
  }
142
148
 
143
149
  if(typeof window == 'undefined') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/dao-vue3",
3
- "version": "0.9.117",
3
+ "version": "0.9.119",
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.117"
13
+ "@live-change/dao": "^0.9.119"
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": "c6cd3d2e3c7312f95d0cca0609b7c0f8fff48ead"
35
+ "gitHead": "b93111cbcd227526a64a46e14dda74adf03064fe"
36
36
  }