Skip to content

fix(designer-v2): disable Publish for empty workflow#9340

Open
rllyy97 wants to merge 2 commits into
mainfrom
rllyy97-fix-consumption-publish-button-empty-wor
Open

fix(designer-v2): disable Publish for empty workflow#9340
rllyy97 wants to merge 2 commits into
mainfrom
rllyy97-fix-consumption-publish-button-empty-wor

Conversation

@rllyy97

@rllyy97 rllyy97 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

Fixes #8571. In the New Experiment – Consumption designer, a freshly created workflow with no triggers and no actions still had an enabled Publish button; clicking it saved an empty workflow.

The root cause is that an "empty" workflow is not actually empty in Redux state. The BJS deserializer inserts a placeholder trigger node (builtin:newWorkflowTrigger, constants.NODE.TYPE.PLACEHOLDER_TRIGGER) into state.workflow.operations and marks it isTrigger: true. Because of that placeholder, existing selectors (useIsGraphEmpty, useRootTriggerId, useAllSelectableNodeIds) all report the workflow as non-empty, so the command bar's saveIsDisabled never disabled Publish.

This PR adds a reusable useIsWorkflowEmpty selector to designer-v2 that treats the placeholder trigger as "not a real operation" (empty = every operation id is the placeholder, or none exist), and wires it into the Standalone Consumption command bar's saveIsDisabled. A trigger-only workflow remains publishable — only fully empty workflows (no real trigger and no actions) disable Publish, matching the issue wording.

Scope is limited to designer-v2 (the new experiment); v1 is intentionally out of scope since the issue no longer reproduces there.

Note: the pre-commit npm run extract hook removed 4 orphaned entries from Localize/lang/strings.json (workflow-name-validation keys with zero remaining source references). This is deterministic tooling cleanup, unrelated to the fix itself.

Impact of Change

  • Users: In the new-experiment Consumption designer, the Publish button is now disabled for a fully empty workflow (no trigger and no actions), preventing accidental saves of empty workflows.
  • Developers: New reusable useIsWorkflowEmpty hook exported from @microsoft/logic-apps-designer-v2 for detecting truly-empty workflows (ignores the placeholder trigger).
  • System: No architectural or dependency changes; a single memoized selector added.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in: new unit spec workflowSelectors.isEmpty.spec.tsx (5/5 passing) covering empty/placeholder-only ⇒ disabled, and real-trigger / action-present / trigger+action ⇒ enabled; Biome clean; tsc --noEmit clean on designer-v2.

Contributors

@rllyy97

Screenshots/Videos

N/A — button enabled/disabled state only.

Add useIsWorkflowEmpty selector that ignores the placeholder trigger, and wire it into the new-experiment Consumption command bar so the Publish button is disabled when the workflow has no real trigger and no actions.

Fixes #8571

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 18:02
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: fix(designer-v2): disable Publish for empty workflow
  • Issue: None — this is clear, specific, and matches the change.
  • Recommendation: No change needed.

Commit Type

  • Properly selected (fix).
  • Only one option is checked, which is correct.

Risk Level

  • The selected risk level (Low) matches the scope and the code diff. I do not see evidence that this should be higher.

What & Why

  • Current: Well filled out with clear context, root cause, scope, and intended behavior.
  • Issue: None.
  • Recommendation: No change needed.

Impact of Change

  • The impact section is complete and aligned with the implementation.
  • Recommendation:
    • Users: Accurate.
    • Developers: Accurate.
    • System: Accurate.

Test Plan

  • Satisfies the test-plan requirement: unit tests were added/updated in the diff, and manual testing is documented.
  • No issue here.

Contributors

  • Included.
  • Recommendation: Optional only; no action required.

Screenshots/Videos

  • N/A is appropriate for this non-visual state change.
  • Recommendation: No change needed.

Summary Table

Section Status Recommendation
Title No change needed
Commit Type No change needed
Risk Level No change needed
What & Why No change needed
Impact of Change No change needed
Test Plan No change needed
Contributors Optional only
Screenshots/Videos No change needed

This PR passes review for PR title/body compliance.

Note: I did not raise the advised risk level above the submitter’s estimate; low is appropriate for this narrowly scoped selector/command-bar change with accompanying unit tests.


Last updated: Wed, 01 Jul 2026 19:58:53 GMT

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue in designer-v2 (New Experiment – Consumption) where a brand-new workflow (containing only the placeholder trigger node) incorrectly allowed Publish. It introduces a selector/hook that treats the placeholder trigger as “empty workflow” and uses it to disable Publish accordingly.

Changes:

  • Added useIsWorkflowEmpty to detect workflows that only contain the placeholder trigger (or no operations).
  • Wired useIsWorkflowEmpty into the Standalone Consumption command bar to disable Publish for truly empty workflows.
  • Removed orphaned localization string entries as part of deterministic extraction cleanup.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Localize/lang/strings.json Removes unused/orphaned localization keys.
libs/designer-v2/src/lib/core/state/workflow/workflowSelectors.ts Adds a memoized selector + hook to detect “truly empty” workflows (ignores placeholder trigger).
libs/designer-v2/src/lib/core/state/workflow/test/workflowSelectors.isEmpty.spec.tsx Adds unit tests covering empty/placeholder-only vs real trigger/action presence.
libs/designer-v2/src/lib/core/index.ts Exports useIsWorkflowEmpty from the designer-v2 core barrel.
apps/Standalone/src/designer/app/AzureLogicAppsDesigner/DesignerCommandBarV2.tsx Uses useIsWorkflowEmpty to disable the Publish button when the workflow is empty.

Comment on lines +9 to +24
import commonConstants from '../../../../common/constants';
import workflowReducer from '../workflowSlice';
import { useIsWorkflowEmpty } from '../workflowSelectors';

const placeholderTriggerId = commonConstants.NODE.TYPE.PLACEHOLDER_TRIGGER;

const createTestStore = (operations: Record<string, any>) => {
return configureStore({
reducer: {
workflow: workflowReducer,
},
preloadedState: {
workflow: { operations } as any,
},
});
};

@rllyy97 rllyy97 Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Updated the test to spread initialWorkflowState and override operations, so the slice shape stays consistent. Dropped the broad "as any" in favor of a narrow "as Operations" cast on just the operations map (the selector only inspects operation ids, so the values are intentionally minimal). Fixed in 6108f2e.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage Check

The following changed files need attention:

⚠️ libs/designer-v2/src/lib/core/state/workflow/workflowSelectors.ts - 27% covered (needs improvement)

Please add tests for the uncovered files before merging.

@rllyy97 rllyy97 added the risk:low Low risk change with minimal impact label Jul 1, 2026
Spread initialWorkflowState and cast only operations to keep the slice shape consistent and drop the broad 'as any', per PR review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rllyy97 rllyy97 enabled auto-merge (squash) July 1, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:low Low risk change with minimal impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New Experiment-Consumption]: Publish button remains enabled for empty workflow

4 participants