After deserializing, links dont get render UNTIL I click on the srd-diagram element
Issue:
Every list I have is a model on its own. When I select a list I update the model by adding 2 root nodes (the white node and the plus sign node). I click on the plus sign node to display a menu and I create click on the TASK button to create a new node on the model. After I do that I see the model now has 4 nodes and 2 edges correctly, but only the nodes get rendered. Until I click on the srd-diagram element the edges are shown.

Other notes: Before I added engine.repaintCanvas() to the createTask method, neither the second node or the edges were rendered until I made a click. When I added repaintCanvas the 2nd node gets rendered but not the edges, until I click. I tried with forceUpdate but no luck. Im using version 5.2.1
This is the method that gets called when I click on the Task button on the popup menu:
const handleCreateTask = node => {
console.log('++ Inside handleCreateTask || node =', node);
const newStep = new StepNodeModel({
name: 'Step Name',
assignee: 'Unassigned',
dashboard: 'No dashboard',
type: 'step-node',
});
newStep.addInPort('In');
const stepPortOut = newStep.addOutPort('Out');
const newBtn = new ButtonNodeModel({
type: 'btn-menu-node',
handleCreateTask
});
const btnPortIn = newBtn.addInPort('In');
newBtn.addOutPort('Out');
const link = stepPortOut.link(btnPortIn);
newStep.setPosition(100, 200);
const newBtnPosition = {
x: newStep.x + diagramManager.createNodeBtnOffsetX,
y: newStep.y + diagramManager.nodeTopMargin
}
newBtn.setPosition(newBtnPosition.x, newBtnPosition.y);
engineForCurrentAnaplanList.diagramModel.addAll(newStep, newBtn, link);
engineForCurrentAnaplanList.recalculatePortsVisually();
engineForCurrentAnaplanList.repaintCanvas();
// forceUpdate();
}```
Update: I fixed it following the comment on https://github.com/projectstorm/react-diagrams/issues/188. In my react application im using stateless components and hooks so to simulate a forceUpdate I did this inside my component
const [, updateState] = useState();
const forceUpdate = useCallback(()=>updateState({}),[]);
I solved it by just setting the same model again after deserializeModel
let model = new DiagramModel();
engine.setModel(model);
...
model.deserializeModel(graph, engine);
engine.setModel(model); // <-- this seems to trigger the update
engine.repaintCanvas();
Edit: Using the current Beta
@saschb2b In the latest codebase (don't know what it looked like at the time you used it) calling setModel() calls engine.repaintCanvas() anyway so the last line may not be required.