From b063ebd6d7347ac70f760a2221aa473fea34e6d2 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 15 Oct 2025 13:37:37 +0200 Subject: [PATCH] reload dashboard on version change --- dashboard/src/Index.vue | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dashboard/src/Index.vue b/dashboard/src/Index.vue index 6003ff4f3..048fa4f1d 100644 --- a/dashboard/src/Index.vue +++ b/dashboard/src/Index.vue @@ -74,10 +74,6 @@ const VIEWS = Object.freeze({ const offlineOverlay = useTemplateRef('offlineOverlay'); -function onOnline() { - ready.value = true; -} - fetcher.globalOptions.errorHook = (error) => { // network error, request killed by browser if (error instanceof TypeError) { @@ -219,10 +215,22 @@ async function refreshProfile() { async function refreshConfigAndFeatures() { const [error, result] = await dashboardModel.config(); if (error) return console.error(error); + + if (result.version !== localStorage.getItem('version')) { + console.log('Dashboard version changed, reloading'); + localStorage.setItem('version', result.version); + window.location.reload(true); + } + config.value = result; features.value = result.features; } +async function onOnline() { + ready.value = true; + await refreshConfigAndFeatures(); // reload dashboard if needed after an update +} + provide('subscriptionRequiredDialog', subscriptionRequiredDialog); provide('features', features); provide('profile', profile); @@ -259,6 +267,8 @@ onMounted(async () => { window.addEventListener('hashchange', onHashChange); onHashChange(); + console.log(`Cloudron dashboard v${config.value.version}`); + ready.value = true; });