We are trying to change a link parameter on some user action. We are trying to do it by finding the link first and then updating the parameter for it and are using findLinkForKey. However, we noticed that even though the link is existing this method is returning null which is why our parameter update is failing. On page reload, this is not happening. Can someone suggest why this would happen.
We are updating the key on an event dispatch. This event dispatch occurs when the link is drawn, and we configure this mapping in the diagram configuration. We catch the event in the linkDrawn method. However, in this method, the diagram provides us with the default key (i.e., -1). Subsequently, we attempt to update the key (our generated key) in the linkData object.
Afterwards, we call the method setEdgeDetails. Within this method, we invoke diagram.model.commit to update the details. We have also attempted to update the key here. However, none of the above steps seem to work.
We can observe that the key is updated in the diagram object. However, when we perform findLinkForKey on the diagram, it returns null. Additionally, when we use the default key (-1), it returns the link details.
Could you please review our approach and see if we are missing something here? Specifically, is there anything we need to consider to ensure that findLinkForKey returns the updated link details correctly?