Skip to content
Snippets Groups Projects
Commit 4519c09c authored by richard.petersen's avatar richard.petersen :sailboat:
Browse files

Fix: OXUIB-1289 - UI-Middleware breaks if UI-Containers are not available

Root cause: If some of the UI containers is not available after successful start, the version update check might fail.
Solution: Add error handlers when manifests can not be fetched after startup
parent ddaa2d18
No related branches found
No related tags found
Loading
......@@ -41,6 +41,8 @@ export function createApp () {
const stopTimer = startUpTimeGauge.startTimer()
try {
const viteManifests = await loadViteManifests()
// also need to load ox manifests here, to make sure the cache is warm
await getOxManifests()
const deps = viteManifestToDeps(viteManifests)
await fileCache.warmUp(viteManifests, deps)
} catch (e) {
......
......@@ -96,8 +96,8 @@ export const getOxManifests = (() => {
let prevHash
let oxManifestCache
return async function getOxManifests () {
const viteManifest = await loadViteManifests()
if (viteManifest.__hash__ !== prevHash) {
const viteManifest = await loadViteManifests().catch(() => {})
if (viteManifest && viteManifest.__hash__ !== prevHash) {
oxManifestCache = viteToOxManifest(viteManifest)
prevHash = viteManifest.__hash__
}
......@@ -124,8 +124,9 @@ export const getDependencies = (() => {
let prevHash
let depCache
return async function getDependencies () {
const viteManifest = await loadViteManifests()
if (viteManifest.__hash__ !== prevHash) {
// simply catch the error here. This might happen, when one of the UI containers is temporarily not available
const viteManifest = await loadViteManifests().catch(() => {})
if (viteManifest && viteManifest.__hash__ !== prevHash) {
depCache = viteManifestToDeps(viteManifest)
prevHash = viteManifest.__hash__
}
......@@ -143,8 +144,8 @@ export const getVersion = (() => {
let prevHash
let versionString
return async function getVersion () {
const viteManifest = await loadViteManifests()
if (viteManifest.__hash__ !== prevHash) {
const viteManifest = await loadViteManifests().catch(() => {})
if (viteManifest && viteManifest.__hash__ !== prevHash) {
versionString = `${+new Date()}.${viteManifest.__hash__}`
prevHash = viteManifest.__hash__
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment