refactor(editor): Detangle versions store from settings store (no-changelog) (#16508)

This commit is contained in:
Alex Grozav
2025-06-20 15:39:47 +03:00
committed by GitHub
parent e413af46ce
commit c59f388321
5 changed files with 6 additions and 6 deletions

View File

@@ -51,7 +51,7 @@ describe('usePageRedirectionHelper', () => {
writable: true, writable: true,
}); });
versionStore.setVersionNotificationSettings({ versionStore.initialize({
enabled: true, enabled: true,
endpoint: '', endpoint: '',
infoUrl: infoUrl:

View File

@@ -66,6 +66,8 @@ export async function initializeCore() {
banners, banners,
}); });
versionsStore.initialize(settingsStore.settings.versionNotifications);
void useExternalHooks().run('app.mount'); void useExternalHooks().run('app.mount');
if (!settingsStore.isPreviewMode) { if (!settingsStore.isPreviewMode) {

View File

@@ -46,7 +46,7 @@ vi.mock('@n8n/stores/useRootStore', () => ({
vi.mock('@/stores/versions.store', () => ({ vi.mock('@/stores/versions.store', () => ({
useVersionsStore: vi.fn(() => ({ useVersionsStore: vi.fn(() => ({
setVersionNotificationSettings: vi.fn(), initialize: vi.fn(),
})), })),
})); }));

View File

@@ -20,7 +20,6 @@ import { UserManagementAuthenticationMethod } from '@/Interface';
import type { IDataObject, WorkflowSettings } from 'n8n-workflow'; import type { IDataObject, WorkflowSettings } from 'n8n-workflow';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { useRootStore } from '@n8n/stores/useRootStore'; import { useRootStore } from '@n8n/stores/useRootStore';
import { useVersionsStore } from './versions.store';
import { makeRestApiRequest } from '@n8n/rest-api-client'; import { makeRestApiRequest } from '@n8n/rest-api-client';
import { useToast } from '@/composables/useToast'; import { useToast } from '@/composables/useToast';
import { useI18n } from '@n8n/i18n'; import { useI18n } from '@n8n/i18n';
@@ -255,7 +254,6 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, () => {
rootStore.setN8nMetadata(fetchedSettings.n8nMetadata || {}); rootStore.setN8nMetadata(fetchedSettings.n8nMetadata || {});
rootStore.setDefaultLocale(fetchedSettings.defaultLocale); rootStore.setDefaultLocale(fetchedSettings.defaultLocale);
rootStore.setBinaryDataMode(fetchedSettings.binaryDataMode); rootStore.setBinaryDataMode(fetchedSettings.binaryDataMode);
useVersionsStore().setVersionNotificationSettings(fetchedSettings.versionNotifications);
if (fetchedSettings.telemetry.enabled) { if (fetchedSettings.telemetry.enabled) {
void eventsApi.sessionStarted(rootStore.restApiContext); void eventsApi.sessionStarted(rootStore.restApiContext);

View File

@@ -59,7 +59,7 @@ export const useVersionsStore = defineStore(STORES.VERSIONS, () => {
currentVersion.value = params.versions.find((v) => v.name === params.currentVersion); currentVersion.value = params.versions.find((v) => v.name === params.currentVersion);
}; };
const setVersionNotificationSettings = (settings: IVersionNotificationSettings) => { const initialize = (settings: IVersionNotificationSettings) => {
versionNotificationSettings.value = settings; versionNotificationSettings.value = settings;
}; };
@@ -107,7 +107,7 @@ export const useVersionsStore = defineStore(STORES.VERSIONS, () => {
infoUrl, infoUrl,
fetchVersions, fetchVersions,
setVersions, setVersions,
setVersionNotificationSettings, initialize,
checkForNewVersions, checkForNewVersions,
}; };
}); });