Skip to content

feat(workflow): one clear condition editor for If/Else#2605

Open
simlarsen wants to merge 1 commit into
feat/workflow-data-chipsfrom
feat/workflow-condition-builder
Open

feat(workflow): one clear condition editor for If/Else#2605
simlarsen wants to merge 1 commit into
feat/workflow-data-chipsfrom
feat/workflow-condition-builder

Conversation

@simlarsen

Copy link
Copy Markdown
Contributor

Another named "worst friction" from the design pass: If/Else's five stacked, manually-type-synced fields. Stacked on #2604 (retargets up the stack as each merges).

Before

Configuring an If/Else step meant filling five generic fields — Input 1 Type, Input 1, Operator, Input 2 Type, Input 2 — where the value field's own description read "This fields takes number, text, boolean, null, undefined as values." You had to think like the evaluator and keep type + value in sync by hand.

After

For the If/Else step only, one readable condition card:

  • ValueCondition (plain-English: "is greater than", "contains", …) → Compare with
  • each value has a compact "treated as" type selector (defaulting to Text) and the data-reference chip helper
  • a one-line note: a true condition runs the Yes branch, otherwise No.

Byte-compatibility (server untouched)

The editor writes exactly the same argument ids — input-1, input-1-type, operator, input-2, input-2-type — so Conditions/IfElse is unchanged. Confirmed against the server: it already defaults an unset operator to == and unset types to Text (IfElse.ts:66-69, 164), which match the editor's defaults — so leaving the sensible defaults writes nothing and evaluates identically. (This is actually an improvement: the old flow forced an explicit operator pick.) ValueType/Operator input types are used by no other component, so the special-case is fully self-contained.

Verification

  • ConditionBuilder.test.tsx (5, RTL/jsdom): shows current values; changing the value / operator / compare-with writes the legacy input-1/operator/input-2 ids; the "treated as" selector writes input-1-type; the type defaults to Text when unset; required-value validity is reported (blocks Save while empty).
  • 49 workflow tests pass; tsc ✓, eslint ✓.

🤖 Generated with Claude Code

…acked fields)

Configuring an If/Else step meant filling five generic, manually-type-synced
fields — "Input 1 Type", "Input 1", "Operator", "Input 2 Type", "Input 2" —
with a field description literally reading "This fields takes number, text,
boolean, null, undefined as values." It made you think like the evaluator.

This replaces them, for the If/Else step only, with one readable condition
card: a Value, a plain-English Condition ("is greater than", "contains", …),
and a Compare-with value, each with a compact "treated as" type selector
(defaulting to Text) and the data-reference chip helper. It also states plainly
that a true condition runs the Yes branch, otherwise No.

The editor writes exactly the same argument ids (input-1, input-1-type,
operator, input-2, input-2-type), so the server evaluator
(Conditions/IfElse) is untouched. Confirmed byte-compatible: the server
already defaults an unset operator to "==" and unset types to Text, matching
the editor's defaults — so leaving the sensible defaults writes nothing and
evaluates identically (an improvement over the old flow, which forced an
explicit operator pick). ValueType/Operator input types are used by no other
component, so the special-case is self-contained.

Tests: ConditionBuilder (5 RTL cases — shows current values, writes the legacy
ids on change incl. the type selector, defaults type to Text, and reports
required-value validity). 49 workflow tests pass; tsc + eslint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@simlarsen

Copy link
Copy Markdown
Contributor Author

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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