fix(vscode): prevent multiple Create clicks in convert-to-workspace webview#9148
Conversation
When a user opened a logic app without a workspace and chose to convert
it, clicking Create on the review page required multiple clicks before
the webview actually proceeded. The button had no pending state so
repeated clicks could queue duplicate create messages.
Fix:
- Dispatch setLoading(true) on the first Create click so the button is
immediately disabled (via disabled={isLoading}) and shows a spinner
- Guard handleCreate with an early return when isLoading is already true
- Replace hardcoded command strings with ExtensionCommand constants
- Add an isCreateInProgress flag in workspaceWebviewCommandHandler so
duplicate postMessages that arrive before the webview is disposed are
silently dropped on the extension-host side
Tests:
- New Vitest unit test asserts the convertToWorkspace flow sends
createWorkspaceStructure command and sets isLoading=true on first click
- ExTester E2E test in workspaceConversionCreate.test.ts now:
- Asserts the Create button is enabled before clicking
- Clicks it exactly once using Selenium Actions API
- Asserts the button enters pending/disabled state or workspace is
created immediately (waitForSingleCreateClickToStart)
- Fails if the .code-workspace file is not created (was previously
only logging a diagnostic message)
- Added E2E_MODE=conversioncreateonly runner mode in run-e2e.js for
targeted local and CI execution of Phase 4.8b
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
|
| Section | Status | Recommendation |
|---|---|---|
| Title | ✅ | Keep as-is or optionally add (prevents duplicate submissions) |
| Commit Type | ✅ | None |
| Risk Level | ✅ | None |
| What & Why | ✅ | None |
| Impact of Change | ✅ | None |
| Test Plan | ✅ | Consider adding explicit run commands in the body |
| Contributors | Add credit for contributors if any | |
| Screenshots/Videos | Optional: add a short screenshot/GIF of pending state |
Final message
This PR passes the PR title/body checklist. The submitter's risk assessment (Medium) matches the code changes and labels; the test plan claims are substantiated by the diff (unit + E2E tests added/updated). The only suggested improvements are minor:
- Add contributor credits (optional but recommended).
- Optionally include the commands to run the new tests locally and/or a short screenshot/GIF showing the pending state for the Create button to help reviewers.
Please update the Contributors field if anyone else contributed, and consider adding the test commands to the Test Plan section. Thanks for the thorough description and the added tests — this looks ready for review/merge.
Last updated: Mon, 11 May 2026 23:57:39 GMT
🤖 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
|
| Section | Status | Recommendation |
|---|---|---|
| Title | ✅ | Keep as-is |
| Commit Type | ✅ | Keep as-is |
| Risk Level | ❌ | Add GitHub label risk:medium to match PR body |
| What & Why | ❌ | Add concise "What & Why" (2–4 sentences) |
| Impact of Change | ❌ | Fill Users/Developers/System impact (see suggestions) |
| Test Plan | ❌ | Mark Unit and E2E checkboxes and summarize tests added |
| Contributors | Optional: add contributors if applicable | |
| Screenshots/Videos | Optional: add if you want to demonstrate UI |
Final Notes & Next Steps
- Overall the code changes look correct and appropriate: you added a defensive
isCreateInProgressflag server-side, early-return guard and setLoading client-side, replaced magic strings with ExtensionCommand constants, and added both unit and E2E coverage. These combine to reduce the chance of duplicate workspace creation. From the diff, the changes are moderate in scope and affect workspace creation UX/flow — sorisk:mediumis appropriate and my advised risk is alsorisk:medium. - Please update the PR body to address the missing items listed above, specifically:
- Add a brief "What & Why" section describing behavior and motivation. Use the suggested text in this review as a starting point.\n 2. Fill out "Impact of Change" (Users/Developers/System) — use the recommendations above.\n 3. Update the "Test Plan" checkboxes to mark Unit tests and E2E tests added/updated and include a short note describing the tests and the new E2E mode name
conversioncreateonly.\n 4. Add the proper GitHub label to match the selected risk level (e.g.risk:medium).\n 5. Optionally fill Contributors and add an illustrative screenshot/GIF if helpful.
- Add a brief "What & Why" section describing behavior and motivation. Use the suggested text in this review as a starting point.\n 2. Fill out "Impact of Change" (Users/Developers/System) — use the recommendations above.\n 3. Update the "Test Plan" checkboxes to mark Unit tests and E2E tests added/updated and include a short note describing the tests and the new E2E mode name
Once those updates are made, re-request review and this checklist should be able to pass.
Last updated: Thu, 07 May 2026 18:08:27 GMT
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Prevents duplicate “Create” actions in the convert-to-workspace webview by introducing immediate loading/disabled UI and extension-side de-duping, and tightens automated coverage for the single-click flow.
Changes:
- Disable “Create” immediately on first click (loading state + client-side guard) and use
ExtensionCommandconstants. - Drop duplicate create messages on the extension-host side while creation is in progress.
- Add/adjust unit + E2E tests, plus a targeted
conversioncreateonlyE2E runner mode.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/vs-code-react/src/app/createWorkspace/createWorkspace.tsx | Adds loading guard/state and switches to ExtensionCommand constants for create messages. |
| apps/vs-code-react/src/app/createWorkspace/test/createWorkspace.test.tsx | Adds a unit test for convert-to-workspace “Create” behavior and loading state. |
| apps/vs-code-designer/src/test/ui/workspaceConversionCreate.test.ts | Strengthens E2E assertion that one click starts creation / enters pending state. |
| apps/vs-code-designer/src/test/ui/run-e2e.js | Adds conversioncreateonly mode for running only the conversion-create phase. |
| apps/vs-code-designer/src/app/commands/shared/workspaceWebviewCommandHandler.ts | Adds an extension-host de-dupe flag to ignore repeated create messages. |
After convert-to-workspace opens a brand-new VS Code window, `installBinaries` runs in the background and the workspace can have multiple folders. Two pre-existing issues then surfaced as `Could not find path to extension bundle`: 1. `getFunctionsCommand` threw when the global `funcCoreToolsBinaryPath` setting was not yet written by `setFunctionsCommand`, even though the binaries already existed on disk. It now self-heals by inspecting the local dependencies folder and falling back to the install location before throwing. 2. `getExtensionBundleFolder` always used `vscode.workspace.workspaceFolders[0]`, which after convert can be a non-Logic-App project (no host.json declaring the extension bundle). It now accepts an optional `workingDirectory` parameter and the designer/monitoring callers pass the resolved Logic App project path. Also surfaces a friendlier 'dependencies are still installing' error when the func binary path isn't ready, instead of the generic bundle message. Tests: extends `bundleFeed.test.ts` with optional working-directory and friendly-error coverage; new `funcVersion.test.ts` for the `getFunctionsCommand` self-heal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Commit Type
Risk Level
What & Why
When a user opened a logic app without a workspace and chose to convert it, clicking Create on the review page required multiple clicks before the webview actually proceeded. The button had no pending state so repeated clicks could queue duplicate create messages.
Fix:
Tests:
Impact of Change
Test Plan
Validated test files/commands:
pnpm --filter vscode-react test:extension-unit -- createWorkspace)pnpm --filter vscode-designer test:extension-unit -- workspaceWebviewCommandHandler bundleFeed funcVersion openDesignerForLocalProject openMonitoringViewForLocal)E2E_MODE=conversioncreateonly node src/test/ui/run-e2e.js)npx tsup --config tsup.e2e.test.config.ts)Contributors
Screenshots/Videos