Skip to content

Fix/1129 input editor context value - #1130

Open
zer0bugz wants to merge 2 commits into
elsa-workflows:mainfrom
zer0bugz:fix/1129-input-editor-context-value
Open

zer0bugz wants to merge 2 commits into
elsa-workflows:mainfrom
zer0bugz:fix/1129-input-editor-context-value

Conversation

@zer0bugz

@zer0bugz zer0bugz commented Oct 16, 2026 •

Copy link
Copy Markdown

Purpose

Fix input editors (e.g. Switch Cases) showing stale values after an edit: DisplayInputEditorContext.UpdateValueAsync now updates Value before notifying.

Fixes #1129


Scope

Select one primary concern:

  • Bug fix (behavior change)
  • Refactor (no behavior change)
  • Documentation update
  • Formatting / code cleanup
  • Dependency / build update
  • New feature

If this PR includes multiple unrelated concerns, please split it before requesting review.


Description

Problem

UpdateValueAsync called OnValueChanged but never updated the context's Value, unlike UpdateExpressionAsync. Since #670, InputsTab reuses editor contexts across value changes, so editors that re-read the context in OnParametersSet reload the stale value when the parent re-renders. In the Cases editor, a committed row edit goes back to the old values until the page is refreshed or the property tabs are switched. HttpStatusCodes, InputPicker and VariablePicker use the same method.

Solution

Set Value before calling OnValueChanged, matching UpdateExpressionAsync. Added unit tests in Elsa.Studio.Core.Tests covering both the update and its ordering relative to the notification.


Verification

Steps:

  1. Add a Switch activity to a workflow and select it.
  2. In the Inputs tab, edit a case's label or condition and click the commit (✓) button.
  3. Run dotnet test src/framework/Elsa.Studio.Core.Tests --filter DisplayInputEditorContextTests.

Expected outcome:
The Cases table shows the edited values right away, without a refresh or tab switch, and both tests pass.


Checklist

  • The PR is focused on a single concern
  • Commit messages follow the recommended convention
  • Tests added or updated (if applicable)
  • Documentation updated (if applicable)
  • No unrelated cleanup included
  • All tests pass

Summary by CodeRabbit

  • Bug Fixes

    • Input editor values are now updated before change notifications are invoked, ensuring callbacks observe the latest value.
  • Tests

    • Added coverage to verify value updates and notification order.

Gabriel Ciochina added 2 commits October 16, 2026 13:57
UpdateValueAsync notified the parent but never updated the context's Value. Since InputsTab started reusing editor contexts (via commit 5bc18fd), editors like Cases were reloading the stale value on re-render.

This does a Set Value before notifying (same as UpdateExpressionAsync already does).

Fixes elsa-workflows#1129
@greptile-apps

greptile-apps Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

This PR does not match any of the 1 configured review trigger rule.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 26414600-a4a4-42f2-bddc-33b8a6b280e0
📥 Commits

Reviewing files that changed from the base of the PR and between d57fc46 and 1db0636.

📒 Files selected for processing: 2
  • src/framework/Elsa.Studio.Core.Tests/DisplayInputEditorContextTests.cs
  • src/framework/Elsa.Studio.Core/Models/DisplayInputEditorContext.cs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

UpdateValueAsync now assigns the supplied value to Value before invoking OnValueChanged. Tests check that Value changes and that the handler observes the new value.

Changes: Display input value synchronization

Layer / File(s) Summary
Update value before notification
src/framework/Elsa.Studio.Core/Models/DisplayInputEditorContext.cs, src/framework/Elsa.Studio.Core.Tests/DisplayInputEditorContextTests.cs
UpdateValueAsync sets Value before calling OnValueChanged. Tests verify the assigned value and that the handler sees it.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 1db06

The update makes the new value visible to change handlers, addressing stale editor state. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description follows the repository template. It explains the purpose, selects bug fix scope, describes the problem and solution, provides verification steps and expected outcome, and completes the…
Title check Passed The title identifies the input editor context value fix and matches the main change. It is concise and specific enough for a teammate reviewing project history.
Linked Issues check Passed The direct coding requirements from issue #1129 are met. DisplayInputEditorContext.UpdateValueAsync assigns Value before it invokes OnValueChanged. The focused tests verify the assignment and it…
Out of Scope Changes check Passed The reviewed changes are limited to the shared input-editor context fix and two focused unit tests. Both changes directly support issue #1129 and the stated stale-value behavior. No unrelated change i…
Full details: Description check

Explanation

The description follows the repository template. It explains the purpose, selects bug fix scope, describes the problem and solution, provides verification steps and expected outcome, and completes the applicable checklist. No screenshots are needed because this is a behavior fix with no stated UI asset requirement.

Full details: Linked Issues check

Explanation

The direct coding requirements from issue #1129 are met. DisplayInputEditorContext.UpdateValueAsync assigns Value before it invokes OnValueChanged. The focused tests verify the assignment and its ordering. This supports the Cases editor behavior for reused contexts described in the issue.

Full details: Out of Scope Changes check

Explanation

The reviewed changes are limited to the shared input-editor context fix and two focused unit tests. Both changes directly support issue #1129 and the stated stale-value behavior. No unrelated change is shown.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

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.

Cases editor for Switch / FlowSwitch does not show commited row edits

1 participant