fix(designer-v2): disable Publish for empty workflow#9340
Conversation
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>
🤖 AI PR Validation ReportPR Review ResultsThank you for your submission! Here's detailed feedback on your PR title and body compliance:✅ PR Title
✅ Commit Type
✅ Risk Level
✅ What & Why
✅ Impact of Change
✅ Test Plan
✅ Contributors
✅ Screenshots/Videos
Summary Table
This PR passes review for PR title/body compliance.Note: I did not raise the advised risk level above the submitter’s estimate; Last updated: Wed, 01 Jul 2026 19:58:53 GMT |
There was a problem hiding this comment.
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
useIsWorkflowEmptyto detect workflows that only contain the placeholder trigger (or no operations). - Wired
useIsWorkflowEmptyinto 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. |
| 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, | ||
| }, | ||
| }); | ||
| }; |
There was a problem hiding this comment.
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.
📊 Coverage CheckThe following changed files need attention:
Please add tests for the uncovered files before merging. |
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>
Commit Type
Risk Level
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) intostate.workflow.operationsand marks itisTrigger: true. Because of that placeholder, existing selectors (useIsGraphEmpty,useRootTriggerId,useAllSelectableNodeIds) all report the workflow as non-empty, so the command bar'ssaveIsDisablednever disabled Publish.This PR adds a reusable
useIsWorkflowEmptyselector todesigner-v2that 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'ssaveIsDisabled. 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.
Impact of Change
useIsWorkflowEmptyhook exported from@microsoft/logic-apps-designer-v2for detecting truly-empty workflows (ignores the placeholder trigger).Test Plan
workflowSelectors.isEmpty.spec.tsx(5/5 passing) covering empty/placeholder-only ⇒ disabled, and real-trigger / action-present / trigger+action ⇒ enabled; Biome clean;tsc --noEmitclean on designer-v2.Contributors
@rllyy97
Screenshots/Videos
N/A — button enabled/disabled state only.