From bbda2dad635abb40861e9292465651f5c7c7e657 Mon Sep 17 00:00:00 2001 From: Jaakko Husso Date: Mon, 30 Jun 2025 17:18:28 +0300 Subject: [PATCH] fix(editor): Only do new versions & what's new check after login (#16844) --- packages/frontend/editor-ui/src/init.test.ts | 6 ++++-- packages/frontend/editor-ui/src/init.ts | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/frontend/editor-ui/src/init.test.ts b/packages/frontend/editor-ui/src/init.test.ts index fa33278b932..cf19396495e 100644 --- a/packages/frontend/editor-ui/src/init.test.ts +++ b/packages/frontend/editor-ui/src/init.test.ts @@ -80,13 +80,11 @@ describe('Init', () => { it('should initialize core features only once', async () => { const usersStoreSpy = vi.spyOn(usersStore, 'initialize'); const settingsStoreSpy = vi.spyOn(settingsStore, 'initialize'); - const versionsSpy = vi.spyOn(versionsStore, 'checkForNewVersions'); await initializeCore(); expect(settingsStoreSpy).toHaveBeenCalled(); expect(usersStoreSpy).toHaveBeenCalled(); - expect(versionsSpy).toHaveBeenCalled(); await initializeCore(); @@ -173,6 +171,7 @@ describe('Init', () => { const cloudStoreSpy = vi.spyOn(cloudPlanStore, 'initialize'); const sourceControlSpy = vi.spyOn(sourceControlStore, 'getPreferences'); const nodeTranslationSpy = vi.spyOn(nodeTypesStore, 'getNodeTranslationHeaders'); + const versionsSpy = vi.spyOn(versionsStore, 'checkForNewVersions'); vi.mocked(useUsersStore).mockReturnValue({ currentUser: null } as ReturnType< typeof useUsersStore >); @@ -181,12 +180,14 @@ describe('Init', () => { expect(cloudStoreSpy).not.toHaveBeenCalled(); expect(sourceControlSpy).not.toHaveBeenCalled(); expect(nodeTranslationSpy).not.toHaveBeenCalled(); + expect(versionsSpy).not.toHaveBeenCalled(); }); it('should init authenticated features only once if user is logged in', async () => { const cloudStoreSpy = vi.spyOn(cloudPlanStore, 'initialize'); const sourceControlSpy = vi.spyOn(sourceControlStore, 'getPreferences'); const nodeTranslationSpy = vi.spyOn(nodeTypesStore, 'getNodeTranslationHeaders'); + const versionsSpy = vi.spyOn(versionsStore, 'checkForNewVersions'); vi.mocked(useUsersStore).mockReturnValue({ currentUser: { id: '123' } } as ReturnType< typeof useUsersStore >); @@ -196,6 +197,7 @@ describe('Init', () => { expect(cloudStoreSpy).toHaveBeenCalled(); expect(sourceControlSpy).toHaveBeenCalled(); expect(nodeTranslationSpy).toHaveBeenCalled(); + expect(versionsSpy).toHaveBeenCalled(); await initializeAuthenticatedFeatures(); diff --git a/packages/frontend/editor-ui/src/init.ts b/packages/frontend/editor-ui/src/init.ts index a8b2738f26c..27290316e48 100644 --- a/packages/frontend/editor-ui/src/init.ts +++ b/packages/frontend/editor-ui/src/init.ts @@ -96,8 +96,6 @@ export async function initializeCore() { await usersStore.initialize({ quota: settingsStore.userManagement.quota, }); - - void versionsStore.checkForNewVersions(); } state.initialized = true; @@ -129,6 +127,7 @@ export async function initializeAuthenticatedFeatures( const rolesStore = useRolesStore(); const insightsStore = useInsightsStore(); const uiStore = useUIStore(); + const versionsStore = useVersionsStore(); if (sourceControlStore.isEnterpriseSourceControlEnabled) { try { @@ -170,6 +169,10 @@ export async function initializeAuthenticatedFeatures( void insightsStore.weeklySummary.execute(); } + if (!settingsStore.isPreviewMode) { + void versionsStore.checkForNewVersions(); + } + await Promise.all([ projectsStore.getMyProjects(), projectsStore.getPersonalProject(),