diff --git a/frontend/src/stores/base.ts b/frontend/src/stores/base.ts index 115950ce5..98f577939 100644 --- a/frontend/src/stores/base.ts +++ b/frontend/src/stores/base.ts @@ -145,25 +145,22 @@ export const useBaseStore = defineStore('base', () => { } } - async function loadApp() { + async function hydrateConfig() { try { if (isDesktopApp()) { // On desktop, ignore the default window.API_URL (set by index.html) // and only use a previously stored API URL from localStorage. const storedApiUrl = localStorage.getItem('API_URL') if (storedApiUrl) { - window.API_URL = storedApiUrl + // Hydrate /info before marking ready; otherwise pro-feature gates stay off for returning desktop users. + await checkAndSetApiUrl(storedApiUrl) await authStore.checkAuth() } - await router.isReady() - ready.value = true return } await checkAndSetApiUrl(window.API_URL) await authStore.checkAuth() - await router.isReady() - ready.value = true } catch (e: unknown) { if (e instanceof NoApiUrlProvidedError) { error.value = ERROR_NO_API_URL @@ -173,17 +170,34 @@ export const useBaseStore = defineStore('base', () => { error.value = t('apiConfig.error') return } - error.value = String(e.message) + error.value = String(e instanceof Error ? e.message : e) } } - loadApp() + // Exposed so router guards can await config/auth hydration on direct + // navigation without deadlocking on router.isReady(). + const appReady = hydrateConfig() + + async function loadApp() { + // Re-hydrates (used when the user selects a new API URL from Ready.vue). + await hydrateConfig() + await router.isReady() + ready.value = true + } + + // Initial load: wait on the in-flight hydration, then mark ready once + // the router has settled. + appReady.then(async () => { + await router.isReady() + ready.value = true + }) return { error: readonly(error), loading: readonly(loading), ready: readonly(ready), loadApp, + appReady, currentProject: readonly(currentProject), currentProjectViewId: readonly(currentProjectViewId), diff --git a/frontend/src/styles/custom-properties/colors.scss b/frontend/src/styles/custom-properties/colors.scss index 91e57ce1b..57e3729c9 100644 --- a/frontend/src/styles/custom-properties/colors.scss +++ b/frontend/src/styles/custom-properties/colors.scss @@ -302,6 +302,8 @@ --dropdown-item-hover-background-color: var(--grey-100); --dropdown-item-hover-color: var(--text); --pre-background: var(--grey-200); + --code-background: var(--grey-200); + --code: var(--code-variable); --button-text-hover-background-color: var(--grey-200); --button-hover-color: var(--grey-600); --button-active-color: var(--grey-600);