Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C7 properties panel breaks when template variable assignment is disabled #4382

Closed
barmac opened this issue Jun 19, 2024 · 10 comments · Fixed by #4392
Closed

C7 properties panel breaks when template variable assignment is disabled #4382

barmac opened this issue Jun 19, 2024 · 10 comments · Fixed by #4392
Assignees
Labels
bug Something isn't working channel:support
Milestone

Comments

@barmac
Copy link
Collaborator

barmac commented Jun 19, 2024

Describe the bug

C7 properties panel freezes when template variable assignment is disabled. The error thrown is related to the inputOutput missing unexpectedly, or outputParameter missing unexpectedly if there are more outputs on the element.

Steps to reproduce

  1. Apply the template below:
[
  {
    "name": "output-test",
    "id": "output-test",
    "appliesTo": [
      "bpmn:Task"
    ],
    "properties": [
      {
        "label": "output",
        "description": "disable assignment to reproduce",
        "binding": {
          "type": "camunda:outputParameter",
          "source": "name"
        }
      }
    ]
  }
]
  1. Switch toggle for variable assignment
  2. Properties panel freezes, and it does not update with element selection

Expected behavior

No crash.

Environment

  • OS: [e.g. MacOS 10.2, Windows 10]
  • Camunda Modeler Version: 5.24.0 but not 5.23.0
  • Execution Platform: C7
  • Installed plug-ins: [...]

Additional context

This is a regression.

SUPPORT-22412

@barmac barmac added bug Something isn't working channel:support ready Ready to be worked on labels Jun 19, 2024
@barmac
Copy link
Collaborator Author

barmac commented Jun 19, 2024

This is first broken in bpmn-io/bpmn-js-element-templates@86a3c03

@barmac
Copy link
Collaborator Author

barmac commented Jun 19, 2024

I suspect bpmn-io/properties-panel@bb1cfb0 as there were no big changes in the templates project in the marked commit apart from @bpmn-io/properties-panel version bump.

@barmac
Copy link
Collaborator Author

barmac commented Jun 19, 2024

The direct cause of the problem is an unhandled error in the rendering when we try to get camunda:name of a non-existing output parameter. Somehow after the parameter is removed, we still try to render this component, although it should not be rendered according to this if: https://github.com/bpmn-io/bpmn-js-element-templates/blob/main/src/element-templates/properties-panel/properties/OutputProperties.js#L67
So this is a race condition. Correct flow is: toggle switch -> remove parameter -> render without AssignToProcessVariable; the actual flow is: toggle switch -> remove parameter -> rerender AssignToProcessVariable -> 💣

@barmac
Copy link
Collaborator Author

barmac commented Jun 19, 2024

I've just confirmed that the bug appears when #4382 (comment) is included.

@barmac barmac self-assigned this Jun 19, 2024
@barmac
Copy link
Collaborator Author

barmac commented Jun 19, 2024

My current hypothesis is that the incorrect rerender is due to naive key implementation which is based on the index of the object.

@barmac
Copy link
Collaborator Author

barmac commented Jun 19, 2024

My current hypothesis is that the incorrect rerender is due to naive key implementation which is based on the index of the object.

Setting random keys doesn't help.

@barmac
Copy link
Collaborator Author

barmac commented Jun 19, 2024

Today's findings from a session with @nikku :

ListGroup.js

  // we need to pass the proper (initial) open state when we 
  // initially render an element
  // 
  // at the same time, we compute the state _only_ in the second PASS
  // 
  // ==> So essentially, by design, we render _once_ with the old state.
  // ==> BOOM (!)

@nikku
Copy link
Member

nikku commented Jun 19, 2024

I have a bug fix in place that removes the aweful hacks we add in ListGroup:

image

To be integration tested (manually) tomorrow.

nikku added a commit to bpmn-io/properties-panel that referenced this issue Jun 19, 2024
This simplifies the existing open handling:

* There is no need to compute `newlyAddedItemIds` (and cache it),
  instead we can just compute it from available data and use it
  immediately.
* Removes most of the magic in this file (tm) (r)

Related to camunda/camunda-modeler#4382
@nikku
Copy link
Member

nikku commented Jun 19, 2024

Turned out, as reported, to be a ListGroup related issue (old components used for re-rendering against new model).

Fixed upstream via bpmn-io/properties-panel#369.

@nikku nikku added fixed upstream Requires integration of upstream change and removed ready Ready to be worked on labels Jun 19, 2024
barmac pushed a commit to bpmn-io/properties-panel that referenced this issue Jun 20, 2024
This simplifies the existing open handling:

* There is no need to compute `newlyAddedItemIds` (and cache it),
  instead we can just compute it from available data and use it
  immediately.
* Removes most of the magic in this file (tm) (r)

Related to camunda/camunda-modeler#4382
nikku added a commit to camunda/camunda-bpmn-js that referenced this issue Jun 20, 2024
nikku added a commit that referenced this issue Jun 20, 2024
@nikku nikku mentioned this issue Jun 20, 2024
4 tasks
@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Jun 20, 2024
@bpmn-io-tasks bpmn-io-tasks bot removed the fixed upstream Requires integration of upstream change label Jun 20, 2024
marstamm pushed a commit that referenced this issue Jun 21, 2024
@marstamm
Copy link
Member

Closed through #4392

@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Jun 21, 2024
@marstamm marstamm added this to the M78 milestone Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working channel:support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants