-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Plugins in bpmn-visualization-addons can register event listeners, allocate objects, keep internal references, or start timers.
Since the core library now provides a dispose() method on BpmnVisualization (see process-analytics/bpmn-visualization-js#3415), the core instance can clean up resources, but plugins still cannot.
This may create memory leaks in long-running applications or SPA environments.
Describe the solution you'd like
Add a new plugin lifecycle hook to let plugins release their resources when the underlying BpmnVisualization is disposed.
Proposed changes:
- Add a new optional method
onDispose(): voidon plugins - Add a new
onConfigure(bv)hook for consistency (asonDispose), while keepingconfigure(bv)for backward compatibility - During disposal, the addons wrapper should:
- call
plugin.onDispose?.() - then call
bpmnVisualization.dispose()
- call
Example API:
export interface Plugin {
readonly id: string;
onConfigure?(bv: BpmnVisualization): void;
onDispose?(): void;
// backward compatibility, probably to replace by only keeping onConfigure
configure?(bv: BpmnVisualization): void;
}Describe alternatives you've considered
- Using only
configureand not addingonDispose, but this leaves plugins without a cleanup mechanism. - Naming the method
dispose(), but this can be confusing because the core object already has its owndispose().
onDisposemakes it clear that it is a lifecycle hook.
Additional context
This hook will help plugin authors properly clean up:
- DOM or graph event listeners
- timers or intervals
- references to the
BpmnVisualizationinstance - cached data or internal state
It also aligns plugin lifecycle management with the new disposal capabilities introduced in the core library.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request