feat: Update Workflow class usage on the Frontend for better performance (no-changelog) (#17680)

This commit is contained in:
Alex Grozav
2025-08-04 15:04:00 +03:00
committed by GitHub
parent ff8531d544
commit 279dce639a
66 changed files with 659 additions and 660 deletions

View File

@@ -14,14 +14,10 @@ import {
TEST_ISSUE,
} from './ParameterInputList.test.constants';
import { FORM_NODE_TYPE, FORM_TRIGGER_NODE_TYPE } from 'n8n-workflow';
import type { Workflow } from 'n8n-workflow';
import type { INodeUi } from '../Interface';
import type { MockInstance } from 'vitest';
vi.mock('@/composables/useWorkflowHelpers', () => ({
useWorkflowHelpers: vi.fn().mockReturnValue({
getCurrentWorkflow: vi.fn(),
}),
}));
import { useWorkflowsStore } from '@/stores/workflows.store';
vi.mock('vue-router', async () => {
const actual = await vi.importActual('vue-router');
@@ -40,6 +36,7 @@ vi.mock('vue-router', async () => {
});
let ndvStore: ReturnType<typeof mockedStore<typeof useNDVStore>>;
let workflowStore: ReturnType<typeof mockedStore<typeof useWorkflowsStore>>;
const renderComponent = createComponentRenderer(ParameterInputList, {
props: {
@@ -59,6 +56,7 @@ describe('ParameterInputList', () => {
beforeEach(() => {
createTestingPinia();
ndvStore = mockedStore(useNDVStore);
workflowStore = mockedStore(useWorkflowsStore);
});
it('renders', () => {
@@ -179,20 +177,15 @@ describe('ParameterInputList', () => {
it('should not show triggerNotice if Form Trigger is connected', () => {
ndvStore.activeNode = { name: 'From', type: FORM_NODE_TYPE, parameters: {} } as INodeUi;
workflowHelpersMock.mockReturnValue({
getCurrentWorkflow: vi.fn(() => {
return {
getParentNodes: vi.fn(() => ['Form Trigger']),
nodes: {
'Form Trigger': {
type: FORM_TRIGGER_NODE_TYPE,
parameters: {},
},
},
};
}),
});
workflowStore.workflowObject = {
getParentNodes: vi.fn(() => ['Form Trigger']),
nodes: {
'Form Trigger': {
type: FORM_TRIGGER_NODE_TYPE,
parameters: {},
},
},
} as unknown as Workflow;
const { queryByText } = renderComponent({
props: {