From e3e79a22557209a4b5062d82ba5db3c01c191de9 Mon Sep 17 00:00:00 2001 From: Stefan Ernst <24554551+stefan-ernst@users.noreply.github.com> Date: Mon, 16 Nov 2026 14:10:54 +0100 Subject: [PATCH 1/2] perf(frontend): load locale catalogs in parallel and overlap setup check (WI-2150) --- frontend/src/App.svelte | 26 ++++++++++++++------------ frontend/src/lib/stores/i18n.svelte.js | 21 ++++++++++++--------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index e4ff8a82e..db8eb9526 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -104,21 +104,26 @@ }, SLOW_START_MS); try { - // Initialize i18n (loads user's preferred locale) and instance branding - // (public, no auth). Branding drives the browser tab title and the - // sidebar text on every surface, including pre-auth. - await Promise.all([ + // Initialize i18n (loads the user's preferred locale), instance branding + // (public, no auth), and the setup status together. Branding drives the + // browser tab title and the sidebar text on every surface, including + // pre-auth; the setup check is independent of both and gates whether a + // session is restored. + const [, , setupComplete] = await Promise.all([ withBootstrapDeadline(i18n.init()), brandStore.load({ timeout: BOOTSTRAP_TIMEOUT_MS }), + checkSetupStatus(), ]); + if (attempt !== startupAttempt) return; + i18nReady = true; if (typeof document !== 'undefined') { document.title = brandStore.siteTitle; } - - // Check setup status first - await checkSetupStatus(); - if (attempt !== startupAttempt) return; + setupCompleted = setupComplete; + if (!setupCompleted) { + showWelcomeAssistant = true; + } // Only initialize auth if setup is completed. A transport error is not a // logout: authStore returns it so the startup UI can offer a retry. @@ -365,10 +370,7 @@ // behind the vite proxy), making a fresh, unconfigured instance look // already set up and silently skipping the setup wizard. const status = await setup.getStatus({ timeout: BOOTSTRAP_TIMEOUT_MS }); - setupCompleted = status.setup_completed; - if (!status.setup_completed) { - showWelcomeAssistant = true; - } + return status.setup_completed; } async function loadAndApplyTheme(isAuthenticated, generation) { diff --git a/frontend/src/lib/stores/i18n.svelte.js b/frontend/src/lib/stores/i18n.svelte.js index 87a13a815..3cf4e7fb8 100644 --- a/frontend/src/lib/stores/i18n.svelte.js +++ b/frontend/src/lib/stores/i18n.svelte.js @@ -135,15 +135,18 @@ async function loadTranslations(localeCode) { loading = true; try { - if (localeCode !== DEFAULT_LOCALE) { - await loadFallbackTranslations(); - } - - // Dynamic import for lazy loading - const module = await import(`../locales/${localeCode}/index.js`); - translations = module.default; - if (localeCode === DEFAULT_LOCALE) { - fallbackTranslations = module.default; + // English is the fallback for missing keys in every other locale. Start + // both catalog imports together so a non-English cold start pays one round + // trip instead of awaiting English before requesting the selected locale. + const needsFallback = localeCode !== DEFAULT_LOCALE; + const [, selectedModule] = await Promise.all([ + needsFallback ? loadFallbackTranslations() : Promise.resolve(), + import(`../locales/${localeCode}/index.js`), + ]); + + translations = selectedModule.default; + if (!needsFallback) { + fallbackTranslations = selectedModule.default; } locale = localeCode; setAppLocale(localeCode); From 5bc894c977bda3d2a3a13d71bd64006f142d1178 Mon Sep 17 00:00:00 2001 From: Stefan Ernst <24554551+stefan-ernst@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:51:26 +0100 Subject: [PATCH 2/2] fix(frontend): preserve startup presentation across setup failures --- frontend/src/App.svelte | 25 +++++++++++++------------ frontend/src/lib/locales/de/time.js | 4 ++-- frontend/src/lib/stores/brand.svelte.js | 8 +++++++- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index db8eb9526..0c79f72ab 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -104,22 +104,23 @@ }, SLOW_START_MS); try { - // Initialize i18n (loads the user's preferred locale), instance branding - // (public, no auth), and the setup status together. Branding drives the - // browser tab title and the sidebar text on every surface, including - // pre-auth; the setup check is independent of both and gates whether a - // session is restored. - const [, , setupComplete] = await Promise.all([ - withBootstrapDeadline(i18n.init()), - brandStore.load({ timeout: BOOTSTRAP_TIMEOUT_MS }), + // Load locale, branding, and setup together. Apply startup copy and the + // title even if the setup request is still pending or has failed. + const [, setupComplete] = await Promise.all([ + Promise.all([ + withBootstrapDeadline(i18n.init()), + brandStore.load({ timeout: BOOTSTRAP_TIMEOUT_MS }), + ]).then(() => { + if (attempt !== startupAttempt) return; + i18nReady = true; + if (typeof document !== 'undefined') { + document.title = brandStore.siteTitle; + } + }), checkSetupStatus(), ]); if (attempt !== startupAttempt) return; - i18nReady = true; - if (typeof document !== 'undefined') { - document.title = brandStore.siteTitle; - } setupCompleted = setupComplete; if (!setupCompleted) { showWelcomeAssistant = true; diff --git a/frontend/src/lib/locales/de/time.js b/frontend/src/lib/locales/de/time.js index 8edd071a2..9177b0d3a 100644 --- a/frontend/src/lib/locales/de/time.js +++ b/frontend/src/lib/locales/de/time.js @@ -18,7 +18,7 @@ export default { 'bookFailed': 'Der Zeiteintrag konnte nicht gebucht werden.', 'discardFailed': 'Der Entwurf konnte nicht verworfen werden.', 'menu': { - 'startTimerHint': 'Verwendet das geöffnete Arbeitselement, falls vorhanden', + 'startTimerHint': 'Verwendet den geöffneten Vorgang, falls vorhanden', 'logWork': 'Arbeit erfassen', 'logWorkHint': 'Arbeitszeit manuell erfassen', }, @@ -204,7 +204,7 @@ export default { title: 'Zeiteintrag', subtitle: 'Erfassen Sie Ihre Arbeitsstunden und verwalten Sie Zeiteinträge', addTimeEntry: 'Neuen Zeiteintrag hinzufügen', - 'needWorkspace': 'Öffne einen Arbeitsbereich oder ein Arbeitselement, bevor du einen Timer startest.', + 'needWorkspace': 'Öffne einen Arbeitsbereich oder einen Vorgang, bevor du einen Timer startest.', failedToSave: 'Zeiteintrag konnte nicht gespeichert werden. Bitte überprüfen Sie Ihre Eingaben.', confirmDelete: 'Sind Sie sicher, dass Sie diesen Zeiteintrag löschen möchten?', diff --git a/frontend/src/lib/stores/brand.svelte.js b/frontend/src/lib/stores/brand.svelte.js index add4d0745..64d82fc33 100644 --- a/frontend/src/lib/stores/brand.svelte.js +++ b/frontend/src/lib/stores/brand.svelte.js @@ -12,6 +12,7 @@ let logoFullURL = $state(''); let logoFullURLDark = $state(''); let loaded = $state(false); let loading = $state(false); +let loadPromise = null; function hydrate(value) { if (!value) return; @@ -26,8 +27,13 @@ function hydrate(value) { } async function load(options = {}) { - if (loaded || loading) return; + if (loaded || loading) return loadPromise; loading = true; + loadPromise = loadBranding(options); + return loadPromise; +} + +async function loadBranding(options) { try { hydrate(await brandingApi.get(options)); } catch (error) {