fix(editor): Disable WF version menu only when all actions are unavailable (backport to release-candidate/2.18.x) (#29326)

Co-authored-by: Daria <daria.staferova@n8n.io>
This commit is contained in:
n8n-assistant[bot] 2026-04-27 17:55:26 +03:00 committed by GitHub
parent 6508bce89b
commit 263f0b723e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View File

@ -494,6 +494,21 @@ describe('WorkflowHeaderDraftPublishActions', () => {
expect(queryByTestId('workflow-open-publish-modal-button')).toBeDisabled();
});
it('should keep the version menu enabled when workflow is published with no changes', () => {
workflowsStore.workflowTriggerNodes = [triggerNode];
workflowsStore.workflow.versionId = 'version-1';
workflowDocumentStore.setActiveState({
activeVersionId: 'version-1',
activeVersion: createMockActiveVersion('version-1'),
});
uiStore.markStateClean();
const { getByTestId } = renderComponent();
expect(getByTestId('workflow-open-publish-modal-button')).toBeDisabled();
expect(getByTestId('version-menu-button')).not.toBeDisabled();
});
it('should show publish button enabled when workflow has never been published (no active version)', () => {
workflowsStore.workflowTriggerNodes = [triggerNode];
workflowsStore.workflow.versionId = 'version-1';

View File

@ -352,6 +352,10 @@ const versionMenuActions = computed<Array<ActionDropdownItem<VERSION_ACTIONS>>>(
return actions;
});
const shouldDisableActionDropdown = computed(() => {
return versionMenuActions.value.every((action) => action.disabled);
});
const onNameVersion = async () => {
// If there are unsaved changes, save the workflow first
if (uiStore.stateIsDirty || props.isNewWorkflow) {
@ -560,7 +564,7 @@ defineExpose({
:class="$style.groupButtonRight"
variant="ghost"
icon="chevron-down"
:disabled="!publishButtonConfig.enabled || shouldDisablePublishButton"
:disabled="shouldDisableActionDropdown"
:aria-label="i18n.baseText('node.moreActions')"
data-test-id="version-menu-button"
/>