mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
fix(editor): Only do new versions & what's new check after login (#16844)
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user