Given the following code, we get lots of inconsistent behavior:
diagram.model.addNodeData(data)
const node = diagram.findNodeForData(data)
// then we edit the node and also set some fields if the node is within the virtualized viewport
The problem is, the node variable is often null, sometimes it is not null.
How do we make this more reliable so that node is never null in this case.
I’m wondering if the virtualization has something to do with the inconsistency. If the added Node isn’t in the viewport, perhaps it is being removed from the Diagram.
It appears we might have it working by delaying the logic of adding node data and finding nodes on the diagram based on the data until after the ‘InitialLayoutCompleted’ event fires for both the whole diagram (used in overview) and the virtual diagram.