@kennofizet/apphub-frontend 0.1.2 → 0.1.3
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/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -208,8 +208,6 @@ function reconcileOriginSafety(store) {
|
|
|
208
208
|
|
|
209
209
|
if (store.options.originBlocked && !wasBlocked) {
|
|
210
210
|
disableModuleServices(store)
|
|
211
|
-
} else if (!store.options.originBlocked && (wasBlocked || wasLoading)) {
|
|
212
|
-
enableModuleApi(store)
|
|
213
211
|
}
|
|
214
212
|
}
|
|
215
213
|
|
|
@@ -294,6 +292,7 @@ function applyModuleOptions(store, options = {}) {
|
|
|
294
292
|
enforceDevFriendlyOrigins: nextPublic.enforceDevFriendlyOrigins,
|
|
295
293
|
})
|
|
296
294
|
Object.assign(store.credentials, buildCredentials(options))
|
|
295
|
+
store._zonesSyncKey = null
|
|
297
296
|
applyOriginSafety(store.options, options)
|
|
298
297
|
if (store.credentials.backendUrl && store.credentials.token) {
|
|
299
298
|
void startBootstrapSession(store)
|
|
@@ -332,11 +331,29 @@ function ensureZoneContext(app, store) {
|
|
|
332
331
|
app.provide(APPHUB_ZONE_CONTEXT_KEY, store.zoneContext)
|
|
333
332
|
}
|
|
334
333
|
|
|
335
|
-
function
|
|
334
|
+
function zoneSyncKey(store) {
|
|
335
|
+
const { coreUrl, token } = store.credentials
|
|
336
|
+
return `${coreUrl}::${token}`
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function syncZoneContext(store, { force = false } = {}) {
|
|
336
340
|
syncCoreApi(store)
|
|
337
|
-
if (store.zoneContext)
|
|
338
|
-
|
|
341
|
+
if (!store.zoneContext || !store.coreApi) return
|
|
342
|
+
|
|
343
|
+
const key = zoneSyncKey(store)
|
|
344
|
+
if (!force && store._zonesSyncKey === key && store.zoneContext.state.zones.length > 0) {
|
|
345
|
+
return store._zonesRefreshInflight ?? undefined
|
|
346
|
+
}
|
|
347
|
+
if (store._zonesRefreshInflight) {
|
|
348
|
+
return store._zonesRefreshInflight
|
|
339
349
|
}
|
|
350
|
+
|
|
351
|
+
store._zonesSyncKey = key
|
|
352
|
+
store._zonesRefreshInflight = store.zoneContext.refresh({ skipBootstrap: true })
|
|
353
|
+
.finally(() => {
|
|
354
|
+
store._zonesRefreshInflight = null
|
|
355
|
+
})
|
|
356
|
+
return store._zonesRefreshInflight
|
|
340
357
|
}
|
|
341
358
|
|
|
342
359
|
function ensureModuleState(app, store) {
|
|
@@ -390,11 +407,7 @@ export function installAppHubModule(vueApp, options = {}) {
|
|
|
390
407
|
vueApp.component('AppHubRunner', AppHubRunner)
|
|
391
408
|
|
|
392
409
|
ensureModuleInfrastructure(vueApp, store)
|
|
393
|
-
void startBootstrapSession(store)
|
|
394
|
-
if (!store.options.originBlocked) {
|
|
395
|
-
enableModuleApi(store)
|
|
396
|
-
}
|
|
397
|
-
})
|
|
410
|
+
void startBootstrapSession(store)
|
|
398
411
|
|
|
399
412
|
return facade
|
|
400
413
|
}
|
|
@@ -210,21 +210,21 @@ watch(
|
|
|
210
210
|
)
|
|
211
211
|
|
|
212
212
|
watch(
|
|
213
|
-
() =>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
() => {
|
|
219
|
-
if (!canLoadCatalog()) return
|
|
220
|
-
if (!catalog.loaded || catalog.error === 'no_api') reloadCatalog()
|
|
213
|
+
() => moduleOptions?.originBootstrapLoading,
|
|
214
|
+
(loading, prevLoading) => {
|
|
215
|
+
if (prevLoading && !loading && canLoadCatalog()) {
|
|
216
|
+
reloadCatalog()
|
|
217
|
+
}
|
|
221
218
|
},
|
|
222
219
|
)
|
|
223
220
|
|
|
224
221
|
watch(
|
|
225
222
|
() => [zone?.state?.selectedZoneId, zone?.state?.viewAllZones],
|
|
226
|
-
() => {
|
|
227
|
-
if (
|
|
223
|
+
(current, previous) => {
|
|
224
|
+
if (!previous) return
|
|
225
|
+
if (current[0] === previous[0] && current[1] === previous[1]) return
|
|
226
|
+
if (!canLoadCatalog() || !catalog.loaded) return
|
|
227
|
+
reloadCatalog()
|
|
228
228
|
},
|
|
229
229
|
)
|
|
230
230
|
</script>
|
|
@@ -184,21 +184,21 @@ watch(
|
|
|
184
184
|
)
|
|
185
185
|
|
|
186
186
|
watch(
|
|
187
|
-
() =>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
() => {
|
|
193
|
-
if (!canLoadCatalog()) return
|
|
194
|
-
if (!catalog.loaded || catalog.error === 'no_api') reloadCatalog()
|
|
187
|
+
() => moduleOptions?.originBootstrapLoading,
|
|
188
|
+
(loading, prevLoading) => {
|
|
189
|
+
if (prevLoading && !loading && canLoadCatalog()) {
|
|
190
|
+
reloadCatalog()
|
|
191
|
+
}
|
|
195
192
|
},
|
|
196
193
|
)
|
|
197
194
|
|
|
198
195
|
watch(
|
|
199
196
|
() => [zone?.state?.selectedZoneId, zone?.state?.viewAllZones],
|
|
200
|
-
() => {
|
|
201
|
-
if (
|
|
197
|
+
(current, previous) => {
|
|
198
|
+
if (!previous) return
|
|
199
|
+
if (current[0] === previous[0] && current[1] === previous[1]) return
|
|
200
|
+
if (!canLoadCatalog() || !catalog.loaded) return
|
|
201
|
+
reloadCatalog()
|
|
202
202
|
},
|
|
203
203
|
)
|
|
204
204
|
</script>
|