Skip to content

feat: Add switch task form support - #451

Open
lornakelly wants to merge 2 commits into
open-workflow-specification:feature/node-editingfrom
lornakelly:407/switch-task
Open

lornakelly wants to merge 2 commits into
open-workflow-specification:feature/node-editingfrom
lornakelly:407/switch-task

Conversation

@lornakelly

@lornakelly lornakelly commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Closes: #407

Summary

Implements dynamic form support for switch task cases, introducing ordered-map field type for rendering and editing array-based structures like switch cases through form controls.

Verify: Storybook > Nested Editing > Switch Locked Cases

Main Changes

  • New ordered-map descriptor kind for arrays of single-key objects where order matters (switch cases).
  • Extracted arrayItemsSchema(), now shared by both array detectors.
  • Every other array falls back to the json textarea instead of the string fallback for now
  • applyDirtyValues takes formListPaths and prunes empty leaves only there, so clearing a case's when removes the key rather than committing when: "".
  • OrderedMapRow renders one <fieldset> per case on useFieldArray, with keyName: "__rhfEntryKey" so a case may be named id.

Out of scope

Notes

Filed a bug to be handled separately for default branch of switch cases: #450

Signed-off-by: lornakelly <lornakelly88@gmail.com>
@netlify

netlify Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for openworkflow-editor ready!

Name Link
🔨 Latest commit 85baa90
🔍 Latest deploy log https://app.netlify.com/projects/openworkflow-editor/deploys/6ab663cd60d644000883d8f9
😎 Deploy Preview https://deploy-preview-451--openworkflow-editor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

Copilot review overview

🟡 Changes recommended

Unresolved critical findings include prototype-key data loss and missing context updates that break typechecking.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity

Open (3)
What changed in this PR

Adds dynamic form support for switch-task cases using ordered-map descriptors, editable case rows, and array-aware draft handling.

Changes:

  • Adds ordered-map detection and JSON fallback for arrays.
  • Adds draft pruning for cleared switch-case fields.
  • Updates form context, controls, styling, Storybook coverage, tests, and release notes.

Unresolved findings include prototype-key data loss, an RHF key collision, and missing context updates that break typechecking.

File Summary
packages/​open-workflow-diagram-editor/​tests/​side-panel/​forms/​OrderedMapRow.test.tsx Tests ordered-map rendering and editing.
packages/​open-workflow-diagram-editor/​tests/​side-panel/​forms/​OneOfFieldRow.test.tsx Updates form context fixtures.
packages/​open-workflow-diagram-editor/​tests/​side-panel/​forms/​customFields/​StringControl.test.tsx Updates expression context fixtures.
packages/​open-workflow-diagram-editor/​tests/​side-panel/​forms/​customFields/​NumberControl.test.tsx Updates form context fixtures.
packages/​open-workflow-diagram-editor/​tests/​side-panel/​forms/​customFields/​KeyValueMapField.test.tsx Updates form context fixtures.
packages/​open-workflow-diagram-editor/​tests/​side-panel/​EditFormFooter.switchTask.test.tsx Tests committed switch-case edits.
packages/​open-workflow-diagram-editor/​tests/​core/​taskDraft.test.ts Tests array draft handling and pruning.
packages/​open-workflow-diagram-editor/​tests/​core/​schemaToFormFields.test.ts Tests array descriptor generation.
packages/​open-workflow-diagram-editor/​stories/​nested-editing/​NestedEditing.stories.tsx Enables the editable switch-case story.
packages/​open-workflow-diagram-editor/​src/​side-panel/​SidePanel.css Styles ordered-map controls.
packages/​open-workflow-diagram-editor/​src/​side-panel/​forms/​taskFormContext.ts Adds form-path and expression context helpers.
packages/​open-workflow-diagram-editor/​src/​side-panel/​forms/​TaskForm.tsx Supplies expression variant context.
packages/​open-workflow-diagram-editor/​src/​side-panel/​forms/​FormField.tsx Renders ordered-map case groups.
packages/​open-workflow-diagram-editor/​src/​side-panel/​forms/​FieldControl.tsx Excludes ordered maps from scalar controls.
packages/​open-workflow-diagram-editor/​src/​side-panel/​forms/​customFields/​StringControl.tsx Handles expression variant clearing.
packages/​open-workflow-diagram-editor/​src/​side-panel/​EditFormFooter.tsx Applies ordered-map changes during commit.
packages/​open-workflow-diagram-editor/​src/​core/​taskDraft.ts Applies and prunes edited array values.
packages/​open-workflow-diagram-editor/​src/​core/​schemaToFormFields.ts Adds ordered-map and JSON array descriptors.
.changeset/​switchTask-form.md Records the package release change.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/open-workflow-diagram-editor/src/core/taskDraft.ts Outdated
Comment thread packages/open-workflow-diagram-editor/src/side-panel/forms/FormField.tsx Outdated
Signed-off-by: lornakelly <lornakelly88@gmail.com>

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.

Copilot review overview

🔵 Needs a closer look

The broad form, persistence, and array-handling changes warrant final human review.

Review effort: Lite
Findings: None

Resolved since last review (3)

@lornakelly

Copy link
Copy Markdown
Collaborator Author

DO NOT MERGE until after call task is in

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants