bpmn-io / bpmn-js-properties-panel

A properties panel for bpmn-js.
MIT License
295 stars 197 forks source link

Crash on import without attachment #1092

Open DaSchTour opened 4 days ago

DaSchTour commented 4 days ago

Describe the Bug

I'm trying to load the panel into an angular application. But even as the panel is not attached I get a very cryptic error after loading a diagram. The error unhandled error in event listener TypeError: Cannot read properties of undefined (reading '__H') is thrown.

Steps to Reproduce

  1. Init without any elements to attach to defined (because they are not ready yet)
    new BpmnJS({
    additionalModules: [gridModule, BpmnPropertiesPanelModule, BpmnPropertiesProviderModule],
    }),
  2. Try to import an XML with importXML
  3. Error is thrown with the following stack trace
    at d (hooks.module.js:1:164)
    at p (hooks.module.js:1:293)
    at h (hooks.module.js:1:262)
    at b.BpmnPropertiesPanel [as constructor] (index.esm.js:1481:37)
    at b.O [as render] (preact.module.js:1:8857)
    at L (preact.module.js:1:6367)
    at C (preact.module.js:1:1857)
    at L (preact.module.js:1:6581)
    at q (preact.module.js:1:8978)
    at BpmnPropertiesPanelRenderer._render (index.esm.js:1799:11)

The strange thing is, that the error is thrown on render even as attach was not even called.

Expected Behavior

Either an clear error message is send or the error does not happen.

Environment

nikku commented 3 days ago

@DaSchTour This is where the error may be coming from: We use Preact as a micro library to render UIs inside the toolkit, and aggressive bundlers (Angular is the only one I know) may not properly bundle it.

Could you verify how many preact instances you have in your project? Cf. package-lock for that.

Could you check if it makes any difference whether you spin up your app in DEV vs. production mode?

Could you check if it makes any difference if you run an older properties panel version, i.e. v5.24.0?