@live-change/vue3-ssr 0.9.31 → 0.9.32

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/Api.js +7 -3
  2. package/package.json +4 -4
package/Api.js CHANGED
@@ -94,16 +94,17 @@ class Api extends DaoProxy {
94
94
  }
95
95
  if(lastApiJson) console.log("API CHANGED", lastApiJson, JSON.stringify(newApi))
96
96
  lastApiJson = JSON.stringify(newApi)
97
- api.value = JSON.parse(lastApiJson)
97
+ /// First, generate the API for microservices, then set api.value otherwise, a race condition is possible
98
+ /// if something reacts to the api value, either the client or the config, and uses the microservices API.
98
99
  this.generateServicesApi()
99
100
  })
100
101
  //console.log("SETUP API", api.value)
101
- this.afterPreFetch.push(() => this.generateServicesApi())
102
+ // this.afterPreFetch.push(() => this.generateServicesApi()) - i think it's not needed
102
103
  }
103
104
 
104
105
  generateServicesApi() {
106
+ let apiInfo = this.apiObservable.getValue()
105
107
  const api = this
106
- let apiInfo = api.metadata.api?.value
107
108
  if(!apiInfo) {
108
109
  const cachePath = '["metadata","api"]'
109
110
  if(typeof window != 'undefined') {
@@ -117,6 +118,7 @@ class Api extends DaoProxy {
117
118
  apiInfo = this.prerenderCache.cache.get(cachePath)
118
119
  }
119
120
  }
121
+ if(!apiInfo) throw new Error("API INFO NOT FOUND! UNABLE TO GENERATE SERVICES API!")
120
122
 
121
123
  api.windowId = this.settings.windowId || randomString(10)
122
124
  api.shortWindowId = api.windowId.split('@')[0].slice(-5).replace('.', '')
@@ -197,6 +199,8 @@ class Api extends DaoProxy {
197
199
  this.installInstanceProperties(glob)
198
200
  }
199
201
 
202
+ api.metadata.api.value = apiInfo
203
+
200
204
  if(api.resolveReadyPromise) {
201
205
  api.resolveReadyPromise()
202
206
  api.resolveReadyPromise = null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/vue3-ssr",
3
- "version": "0.9.31",
3
+ "version": "0.9.32",
4
4
  "description": "Live Change Framework - vue components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,10 +21,10 @@
21
21
  },
22
22
  "homepage": "https://github.com/live-change/live-change-stack",
23
23
  "dependencies": {
24
- "@live-change/dao-vue3": "^0.9.31",
25
- "@live-change/uid": "^0.9.31",
24
+ "@live-change/dao-vue3": "^0.9.32",
25
+ "@live-change/uid": "^0.9.32",
26
26
  "@vueuse/core": "^12.3.0",
27
27
  "debug": "^4.3.4"
28
28
  },
29
- "gitHead": "4e12be9d3f339492bb9ddc3c6c77581e52d1ba60"
29
+ "gitHead": "41022fc283020e2da3e82aa27274401052d2379a"
30
30
  }