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
No related merge requests found
...@@ -41,6 +41,8 @@ export function createApp () { ...@@ -41,6 +41,8 @@ export function createApp () {
const stopTimer = startUpTimeGauge.startTimer() const stopTimer = startUpTimeGauge.startTimer()
try { try {
const viteManifests = await loadViteManifests() const viteManifests = await loadViteManifests()
// also need to load ox manifests here, to make sure the cache is warm
await getOxManifests()
const deps = viteManifestToDeps(viteManifests) const deps = viteManifestToDeps(viteManifests)
await fileCache.warmUp(viteManifests, deps) await fileCache.warmUp(viteManifests, deps)
} catch (e) { } catch (e) {
......
...@@ -96,8 +96,8 @@ export const getOxManifests = (() => { ...@@ -96,8 +96,8 @@ export const getOxManifests = (() => {
let prevHash let prevHash
let oxManifestCache let oxManifestCache
return async function getOxManifests () { return async function getOxManifests () {
const viteManifest = await loadViteManifests() const viteManifest = await loadViteManifests().catch(() => {})
if (viteManifest.__hash__ !== prevHash) { if (viteManifest && viteManifest.__hash__ !== prevHash) {
oxManifestCache = viteToOxManifest(viteManifest) oxManifestCache = viteToOxManifest(viteManifest)
prevHash = viteManifest.__hash__ prevHash = viteManifest.__hash__
} }
...@@ -124,8 +124,9 @@ export const getDependencies = (() => { ...@@ -124,8 +124,9 @@ export const getDependencies = (() => {
let prevHash let prevHash
let depCache let depCache
return async function getDependencies () { return async function getDependencies () {
const viteManifest = await loadViteManifests() // simply catch the error here. This might happen, when one of the UI containers is temporarily not available
if (viteManifest.__hash__ !== prevHash) { const viteManifest = await loadViteManifests().catch(() => {})
if (viteManifest && viteManifest.__hash__ !== prevHash) {
depCache = viteManifestToDeps(viteManifest) depCache = viteManifestToDeps(viteManifest)
prevHash = viteManifest.__hash__ prevHash = viteManifest.__hash__
} }
...@@ -143,8 +144,8 @@ export const getVersion = (() => { ...@@ -143,8 +144,8 @@ export const getVersion = (() => {
let prevHash let prevHash
let versionString let versionString
return async function getVersion () { return async function getVersion () {
const viteManifest = await loadViteManifests() const viteManifest = await loadViteManifests().catch(() => {})
if (viteManifest.__hash__ !== prevHash) { if (viteManifest && viteManifest.__hash__ !== prevHash) {
versionString = `${+new Date()}.${viteManifest.__hash__}` versionString = `${+new Date()}.${viteManifest.__hash__}`
prevHash = 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