mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 13:27:31 -08:00
fix(editor): Prevent setting sticky node as active node on new canvas (no-changelog) (#11141)
This commit is contained in:
parent
9539504eaf
commit
0321582c11
|
@ -22,7 +22,7 @@ import { useCredentialsStore } from '@/stores/credentials.store';
|
||||||
import { waitFor } from '@testing-library/vue';
|
import { waitFor } from '@testing-library/vue';
|
||||||
import { createTestingPinia } from '@pinia/testing';
|
import { createTestingPinia } from '@pinia/testing';
|
||||||
import { mockedStore } from '@/__tests__/utils';
|
import { mockedStore } from '@/__tests__/utils';
|
||||||
import { SET_NODE_TYPE, STORES } from '@/constants';
|
import { SET_NODE_TYPE, STICKY_NODE_TYPE, STORES } from '@/constants';
|
||||||
import type { Connection } from '@vue-flow/core';
|
import type { Connection } from '@vue-flow/core';
|
||||||
import { useClipboard } from '@/composables/useClipboard';
|
import { useClipboard } from '@/composables/useClipboard';
|
||||||
|
|
||||||
|
@ -252,6 +252,24 @@ describe('useCanvasOperations', () => {
|
||||||
|
|
||||||
await waitFor(() => expect(ndvStore.setActiveNodeName).toHaveBeenCalledWith('Test Name'));
|
await waitFor(() => expect(ndvStore.setActiveNodeName).toHaveBeenCalledWith('Test Name'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not set sticky node type as active node', async () => {
|
||||||
|
const ndvStore = useNDVStore();
|
||||||
|
const nodeTypeDescription = mockNodeTypeDescription({ name: STICKY_NODE_TYPE });
|
||||||
|
|
||||||
|
const { addNode } = useCanvasOperations({ router });
|
||||||
|
addNode(
|
||||||
|
{
|
||||||
|
type: STICKY_NODE_TYPE,
|
||||||
|
typeVersion: 1,
|
||||||
|
name: 'Test Name',
|
||||||
|
},
|
||||||
|
nodeTypeDescription,
|
||||||
|
{ openNDV: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
await waitFor(() => expect(ndvStore.setActiveNodeName).not.toHaveBeenCalled());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('resolveNodePosition', () => {
|
describe('resolveNodePosition', () => {
|
||||||
|
|
|
@ -610,10 +610,10 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
|
|
||||||
if (nodeData.type !== STICKY_NODE_TYPE) {
|
if (nodeData.type !== STICKY_NODE_TYPE) {
|
||||||
void externalHooks.run('nodeView.addNodeButton', { nodeTypeName: nodeData.type });
|
void externalHooks.run('nodeView.addNodeButton', { nodeTypeName: nodeData.type });
|
||||||
}
|
|
||||||
|
|
||||||
if (options.openNDV && !preventOpeningNDV) {
|
if (options.openNDV && !preventOpeningNDV) {
|
||||||
ndvStore.setActiveNodeName(nodeData.name);
|
ndvStore.setActiveNodeName(nodeData.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue