fix(editor): Hide template setup button when only disabled nodes lack credentials

This commit is contained in:
Ricardo Espinoza
2026-06-18 22:56:54 -04:00
parent 31f718f8f8
commit d48b629eaf
2 changed files with 44 additions and 1 deletions
@@ -300,6 +300,47 @@ describe('SetupWorkflowCredentialsButton', () => {
const { getByTestId } = renderComponent();
expect(getByTestId('setup-credentials-button')).toBeVisible();
});
it('ignores disabled nodes when deciding whether all credentials are filled', () => {
const nodes = [
{
id: '1',
name: 'OpenAI Model',
type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',
typeVersion: 1,
position: [0, 0] as [number, number],
parameters: {},
},
{
id: '2',
name: 'Disabled Slack',
type: 'n8n-nodes-base.slack',
typeVersion: 1,
position: [200, 0] as [number, number],
parameters: {},
disabled: true,
},
];
workflowsStore.workflowId = workflowWithNodes.id;
setWorkflowDocumentStoreState(
{ templateId: '2722', templateCredsSetupCompleted: false },
nodes,
);
setupPanelStore.isFeatureEnabled = true;
// The enabled node has its credentials filled; the disabled node does not.
mockDoesNodeHaveAllCredentialsFilled.mockImplementation(
(_provider: unknown, node: { id: string }) => node.id === '1',
);
const { queryByTestId } = renderComponent();
expect(queryByTestId('setup-credentials-button')).toBeNull();
// The disabled node must never be checked for credentials.
expect(mockDoesNodeHaveAllCredentialsFilled).not.toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({ id: '2' }),
);
});
});
describe('modal auto-open on mount', () => {
@@ -38,7 +38,9 @@ const allCredentialsFilled = computed(() => {
return true;
}
const nodes = workflowDocumentStore?.value?.allNodes ?? [];
// Disabled nodes are skipped during execution, so their unfilled
// credentials must not keep the setup button visible.
const nodes = (workflowDocumentStore?.value?.allNodes ?? []).filter((node) => !node.disabled);
if (!nodes.length) {
return true;
}