Skip to content

InitializeModelOptions

since v1.3.0

Options for initializeModel and initializeModelAdapter.

optional stripEdgeRuntimeProperties: StripEdgeRuntimePropertiesFn

Replaces the function that strips runtime-computed properties from edges during initialization (and, for the default model created by initializeModel, during toJSON() serialization).

⚠️ Use at your own risk. The default (stripEdgeRuntimeProperties) exists because stale runtime values (sourcePosition, targetPosition, measuredLabels, computedZIndex, _internalId) loaded from persistence can and probably will break the diagram — e.g. edges rendered at outdated positions or duplicated internal ids. The default already preserves the authored free-endpoint position of a dangling edge (empty source/target), so keeping sourcePosition/targetPosition yourself is not needed for that. Overriding this function and keeping such properties is unsupported territory; prefer wrapping the default and re-adding only the properties you know you need.


optional stripNodeRuntimeProperties: StripNodeRuntimePropertiesFn

Replaces the function that strips runtime-computed properties from nodes during initialization (and, for the default model created by initializeModel, during toJSON() serialization).

⚠️ Use at your own risk. The default (stripNodeRuntimeProperties) exists because stale runtime values (selected, measuredPorts, measuredBounds, computedZIndex, _internalId) loaded from persistence can and probably will break the diagram — e.g. skipped DOM measurements, wrong z-ordering, or duplicated internal ids. Overriding this function and keeping such properties is unsupported territory; prefer wrapping the default and re-adding only the properties you know you need.