You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The methods insertVertex and insertEdge come from mxGraph. They take a long list of parameters, which makes them hard to use and maintain. It's also not practical when adding new features, since each new feature often requires an additional parameter.
Optional parameters can just be omitted (no need for null or undefined)
They are easier to read
Easier to extend with new features
However, many examples and parts of the documentation still use the old methods. That makes it harder to encourage adoption of the new APIs and to plan the removal of the legacy ones.
Important
The old methods are already marked as legacy in their JSDoc.
Proposal
We should officially deprecate the legacy methods and promote the new ones. We won’t remove them yet, to avoid breaking changes and help users migrating from mxGraph.
Tasks (non-exhaustive)
Mark insertVertex and insertEdge as @deprecated in the source code
The methods
insertVertexandinsertEdgecome from mxGraph. They take a long list of parameters, which makes them hard to use and maintain. It's also not practical when adding new features, since each new feature often requires an additional parameter.insertVertexlegacy signature:maxGraph/packages/core/src/view/mixins/VertexMixin.type.ts
Lines 86 to 97 in 9130103
insertEdgelegacy signature:maxGraph/packages/core/src/view/mixins/EdgeMixin.type.ts
Lines 185 to 192 in 9130103
In maxGraph, we've already introduced new methods that take a single options object instead of a long list of arguments:
New
insertVertexmethod:maxGraph/packages/core/src/view/mixins/VertexMixin.type.ts
Line 132 in 9130103
New
insertEdgemethod:maxGraph/packages/core/src/view/mixins/EdgeMixin.type.ts
Line 201 in 9130103
These new APIs are easier to use:
nullorundefined)However, many examples and parts of the documentation still use the old methods. That makes it harder to encourage adoption of the new APIs and to plan the removal of the legacy ones.
Important
The old methods are already marked as legacy in their JSDoc.
Proposal
We should officially deprecate the legacy methods and promote the new ones. We won’t remove them yet, to avoid breaking changes and help users migrating from mxGraph.
Tasks (non-exhaustive)
insertVertexandinsertEdgeas@deprecatedin the source code