diff --git a/packages/frontend/editor-ui/eslint.config.mjs b/packages/frontend/editor-ui/eslint.config.mjs index b5cf3dd6e1c..8f28c36d6cc 100644 --- a/packages/frontend/editor-ui/eslint.config.mjs +++ b/packages/frontend/editor-ui/eslint.config.mjs @@ -63,9 +63,9 @@ export default defineConfig( }, { selector: - "MemberExpression[property.name='nodes'][object.property.name='workflow'][object.object.name='workflowsStore']", + "MemberExpression[property.name=/^(name|nodes|connections|active|isArchived|settings|tags|pinData|meta|versionId|activeVersionId|createdAt|updatedAt|parentFolder|scopes|usedCredentials|homeProject|description|versionData)$/][object.property.name='workflow'][object.object.name='workflowsStore']", message: - 'Use workflowDocumentStore node accessors instead of workflowsStore.workflow.nodes', + 'Use the equivalent workflowDocumentStore accessor instead of workflowsStore.workflow.', }, { selector: diff --git a/packages/frontend/editor-ui/src/app/composables/usePushConnection/handlers/executionStarted.test.ts b/packages/frontend/editor-ui/src/app/composables/usePushConnection/handlers/executionStarted.test.ts index cb82fde7972..725b51fd541 100644 --- a/packages/frontend/editor-ui/src/app/composables/usePushConnection/handlers/executionStarted.test.ts +++ b/packages/frontend/editor-ui/src/app/composables/usePushConnection/handlers/executionStarted.test.ts @@ -2,6 +2,10 @@ import { createTestingPinia } from '@pinia/testing'; import { setActivePinia } from 'pinia'; import { executionStarted } from './executionStarted'; import { useWorkflowsStore } from '@/app/stores/workflows.store'; +import { + createWorkflowDocumentId, + useWorkflowDocumentStore, +} from '@/app/stores/workflowDocument.store'; import { mockedStore } from '@/__tests__/utils'; import type { ExecutionStarted } from '@n8n/api-types/push/execution'; import type { WorkflowState } from '@/app/composables/useWorkflowState'; @@ -20,7 +24,7 @@ describe('executionStarted', () => { } beforeEach(() => { - const pinia = createTestingPinia({ stubActions: true }); + const pinia = createTestingPinia({ stubActions: false }); setActivePinia(pinia); workflowsStore = mockedStore(useWorkflowsStore); @@ -43,7 +47,8 @@ describe('executionStarted', () => { workflowsStore.activeExecutionId = null; workflowsStore.workflowExecutionData = null; workflowsStore.workflow.id = 'wf-123'; - workflowsStore.workflow.name = 'My Workflow'; + const workflowDocumentStore = useWorkflowDocumentStore(createWorkflowDocumentId('wf-123')); + workflowDocumentStore.setName('My Workflow'); await executionStarted(makeEvent('exec-1'), mockOptions); diff --git a/packages/frontend/editor-ui/src/app/composables/usePushConnection/handlers/executionStarted.ts b/packages/frontend/editor-ui/src/app/composables/usePushConnection/handlers/executionStarted.ts index ae20e0c6c92..0c5933258d5 100644 --- a/packages/frontend/editor-ui/src/app/composables/usePushConnection/handlers/executionStarted.ts +++ b/packages/frontend/editor-ui/src/app/composables/usePushConnection/handlers/executionStarted.ts @@ -1,5 +1,9 @@ import type { ExecutionStarted } from '@n8n/api-types/push/execution'; import { useWorkflowsStore } from '@/app/stores/workflows.store'; +import { + createWorkflowDocumentId, + useWorkflowDocumentStore, +} from '@/app/stores/workflowDocument.store'; import { parse } from 'flatted'; import { createRunExecutionData } from 'n8n-workflow'; import type { WorkflowState } from '@/app/composables/useWorkflowState'; @@ -35,6 +39,9 @@ export async function executionStarted( // node status (e.g. DemoLayout iframe receiving push events for a new execution). if (!workflowsStore.workflowExecutionData?.data || needsInit) { const wf = workflowsStore.workflow; + const workflowDocumentStore = workflowsStore.workflowId + ? useWorkflowDocumentStore(createWorkflowDocumentId(workflowsStore.workflowId)) + : undefined; options.workflowState.setWorkflowExecutionData({ id: data.executionId, finished: false, @@ -44,7 +51,7 @@ export async function executionStarted( startedAt: new Date(), workflowData: { id: wf.id, - name: wf.name, + name: workflowDocumentStore?.name ?? '', active: wf.active, isArchived: wf.isArchived, nodes: wf.nodes, diff --git a/packages/frontend/editor-ui/src/app/stores/workflows.store.test.ts b/packages/frontend/editor-ui/src/app/stores/workflows.store.test.ts index 91b1742cf96..db646e47af6 100644 --- a/packages/frontend/editor-ui/src/app/stores/workflows.store.test.ts +++ b/packages/frontend/editor-ui/src/app/stores/workflows.store.test.ts @@ -125,7 +125,6 @@ describe('useWorkflowsStore', () => { }); it('should initialize with default state', () => { - expect(workflowsStore.workflow.name).toBe(''); expect(workflowsStore.workflow.id).toBe(''); }); diff --git a/packages/frontend/editor-ui/src/features/ai/assistant/builder.store.test.ts b/packages/frontend/editor-ui/src/features/ai/assistant/builder.store.test.ts index afb5ffb9028..437193ba896 100644 --- a/packages/frontend/editor-ui/src/features/ai/assistant/builder.store.test.ts +++ b/packages/frontend/editor-ui/src/features/ai/assistant/builder.store.test.ts @@ -20,7 +20,6 @@ import { defaultSettings } from '@/__tests__/defaults'; import { createTestNode } from '@/__tests__/mocks'; import merge from 'lodash/merge'; import { DEFAULT_POSTHOG_SETTINGS } from '@/app/stores/posthog.store.test'; -import { DEFAULT_NEW_WORKFLOW_NAME } from '@/app/constants'; import { nextTick, reactive } from 'vue'; import * as chatAPI from '@/features/ai/assistant/assistant.api'; import * as telemetryModule from '@/app/composables/useTelemetry'; @@ -174,7 +173,6 @@ describe('AI Builder store', () => { credentialsStore = mockedStore(useCredentialsStore); workflowsStore.workflowId = 'test-workflow-id'; - workflowsStore.workflow.name = DEFAULT_NEW_WORKFLOW_NAME; workflowsStore.workflow.nodes = []; workflowsStore.workflow.connections = {}; workflowsStore.nodesByName = {};