Why Does Overriding ContextPad Entries Work?

Hi there,

in the source file for the Modeler, there is an example on how to override all entries in the context pad: https://github.com/bpmn-io/bpmn-js/blob/master/lib/Modeler.js#L77.
But I don’t get why this works. Shouldn’t the ContextPad iterate over all context pad providers and merge their entries? I have this from the source files, as well. https://github.com/bpmn-io/diagram-js/blob/master/lib/features/context-pad/ContextPad.js#L106.

For me, this is not about overriding context pad entries solely. I’d like to understand the dependecy injection features in general and I struggled to understand this point.

Thanks for any help!

Best regards
Felix

When playing around with the code a bit, I found the solution! It gets overriden because the name used for the dependency is the same.

Hey, I’m glad you found the solution yourself, that’s awesome! Some hints:

  • the order in which you provide the modules matters, the last one always overrides the previous ones
  • you can also disable modules easily using the same name and providing an empty module