diff --git a/src/main.ts b/src/main.ts index 18d25b615..ca80b87f8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -45,9 +45,6 @@ const firebaseApp = initializeApp(getFirebaseConfig()) const app = createApp(App) const pinia = createPinia() -// Start early bootstrap (api.init, fetchNodeDefs) before Pinia is registered -const bootstrapStore = useBootstrapStore(pinia) -bootstrapStore.startEarlyBootstrap() Sentry.init({ app, dsn: __SENTRY_DSN__, @@ -93,7 +90,7 @@ app modules: [VueFireAuth()] }) -// Start store bootstrap (settings, i18n, workflows) after Pinia is registered +const bootstrapStore = useBootstrapStore(pinia) void bootstrapStore.startStoreBootstrap() app.mount('#vue-app') diff --git a/src/stores/bootstrapStore.test.ts b/src/stores/bootstrapStore.test.ts index f0249e65f..2247f0ea7 100644 --- a/src/stores/bootstrapStore.test.ts +++ b/src/stores/bootstrapStore.test.ts @@ -27,7 +27,9 @@ vi.mock('@/platform/settings/settingStore', () => ({ load: vi.fn(() => { mockIsSettingsReady.value = true }), - isReady: mockIsSettingsReady, + get isReady() { + return mockIsSettingsReady.value + }, isLoading: ref(false), error: ref(undefined) })) @@ -40,6 +42,13 @@ vi.mock('@/platform/workflow/management/stores/workflowStore', () => ({ })) })) +vi.mock('@/stores/userStore', () => ({ + useUserStore: vi.fn(() => ({ + initialize: vi.fn().mockResolvedValue(undefined), + needsLogin: false + })) +})) + describe('bootstrapStore', () => { let store: ReturnType diff --git a/src/stores/bootstrapStore.ts b/src/stores/bootstrapStore.ts index ae875c1b8..224d570ca 100644 --- a/src/stores/bootstrapStore.ts +++ b/src/stores/bootstrapStore.ts @@ -24,8 +24,6 @@ export const useBootstrapStore = defineStore('bootstrap', () => { { immediate: false } ) - function startEarlyBootstrap() {} - async function startStoreBootstrap() { // Defer settings and workflows if multi-user login is required // (settings API requires authentication in multi-user mode) @@ -44,7 +42,6 @@ export const useBootstrapStore = defineStore('bootstrap', () => { return { isI18nReady, i18nError, - startEarlyBootstrap, startStoreBootstrap } })