bpmn-io / bpmn-js-properties-panel

A properties panel for bpmn-js.
MIT License
286 stars 196 forks source link

Redo does not work in FEEL input when undone till empty input #981

Closed barmac closed 9 months ago

barmac commented 10 months ago

Describe the Bug

Given I type in the FEEL entry, when I press cmd+Z and cmd+Y, in FEEL input, redo stops to work as soon as I reach empty input with undo.

Steps to Reproduce

  1. Type in FEEL input
  2. Undo until input is empty
  3. Try to redo
  4. Nothing happens

Expected Behavior

Redo should work.

Environment

marstamm commented 9 months ago

Root Cause

I tested this on Output Mappings.

Output mappings are created with the source target being an empty string <zeebe:output source="" target="Output_1" />. When we add content and remove it again, the source property is removed <zeebe:output target="Output_1" />

When we undo to the initial state:

CommandStack
ID | Command
1.   ...
2.   Add Output Var
------      <-- undo till here
3.   Add Content
4.   ...

this triggers the change handler that removes the source property.

New CommandStack

1. ...
2. Add Output Var
5. Remove `source` property

This breaks the redo chain by adding something to the stack. The command with ID 3 in the example can no longer be reached.

The Change handler should not be triggered on Undo, or handle the property being empty correctly.

marstamm commented 9 months ago

I can only reproduce this issue in Input/Output fields. Other FEEL enabled fields, such as Task type or Script Tasks FEEL expressions manage the undo stack correctly.