question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removing an element template from root element creates error

See original GitHub issue

Describe the Bug

When removing (not unlinking) an element template from a diagram root element (process or collaboration), an error occurs:

diagram_1.bpmn] Cannot read property 'children' of undefined
    at BpmnOrderingProvider.getOrdering (webpack-internal:///./node_modules/bpmn-js/lib/features/ordering/BpmnOrderingProvider.js:148:34)
    at eval (webpack-internal:///./node_modules/diagram-js/lib/features/ordering/OrderingProvider.js:53:25)
    at invokeFunction (webpack-internal:///./node_modules/diagram-js/lib/core/EventBus.js:517:13)
    at EventBus._invokeListener (webpack-internal:///./node_modules/diagram-js/lib/core/EventBus.js:368:19)
    at EventBus._invokeListeners (webpack-internal:///./node_modules/diagram-js/lib/core/EventBus.js:349:24)
    at EventBus.fire (webpack-internal:///./node_modules/diagram-js/lib/core/EventBus.js:310:24)
    at CommandStack._fire (webpack-internal:///./node_modules/diagram-js/lib/command/CommandStack.js:356:29)
    at CommandStack._internalExecute (webpack-internal:///./node_modules/diagram-js/lib/command/CommandStack.js:398:10)
    at CommandStack.execute (webpack-internal:///./node_modules/diagram-js/lib/command/CommandStack.js:153:8)
    at Modeling.createShape (webpack-internal:///./node_modules/diagram-js/lib/features/modeling/Modeling.js:310:22) [ error ]

Steps to Reproduce

  1. Set up some template for bpmn:Process:
[
  {
    "name": "KPI Template",
    "id": "kpi",
    "appliesTo": [
      "bpmn:Collaboration","bpmn:Process","bpmn:Task","bpmn:IntermediateCatchEvent"
    ],
    "properties": [
      {
        "label": "KPI Unit",
        "type": "Dropdown",
        "value": "ms",
        "choices": [
          {
            "name": "Milliseconds", "value": "ms"
          },
          {
            "name": "Seconds", "value": "s"
          },
          {
            "name": "Minutes", "value": "m"
          },
          {
            "name": "Hours", "value": "h"
          }
        ],
        "editable": true,
        "binding": {
          "type": "camunda:property",
          "name": "kpiunit"
        }
      },
      {
        "label": "KPI Threshold",
        "type": "String",
        "value": "",
        "editable": true,
        "binding": {
          "type": "camunda:property",
          "name": "kpi"
        }
      }
    ]
  }
]
  1. Apply element template to bpmn:Process
  2. Remove the element template again (by clicking on Remove)

Expected Behavior

Removal of element template from Process creates no error / diagram is still valid.

Environment

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
philippfrommecommented, Mar 4, 2021

As an alternative to this bug fix we could also keep applying any templates on root elements disabled, for example.

I’d disable templates for root elements for now. Supporting them e2e including removal is not trivial and exceeds the initial scope of fixing a bug.

1reaction
pinussilvestruscommented, Mar 4, 2021

Nice Investigations @MaxTru 👏

I’d second @philippfromme @nikku 's opinion, if it’s too much hustle to support it, let’s not do it now. Your findings are a good starting point when we tackle it in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue js error: Component template should contain exactly one ...
Currently, a VueJS template can contain only one root element (because of rendering issue); In cases you really need to have two root...
Read more >
Map XML elements to cells in an XML Map - Microsoft Support
Learn about adding and removing XML mapping to an Excel workbook. ... Create an XML table by mapping the dataroot element. See Map...
Read more >
23 Creating Template, CSElement, and SiteEntry Assets
The Cache Rules field has been simplified to reduce errors. ... The element in that CSElement asset becomes the root element for the...
Read more >
TAL Reference — Page Templates 1.6 documentation
tal:omit-tag: remove an element, leaving the content of the element. tal:on-error: handle errors. tal:repeat: repeat an element ...
Read more >
XSLT <xsl:template> Element - W3Schools
The match="/" attribute associates the template with the root of the XML source document. The content inside the <xsl:template> element defines some HTML...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found