Link not drawing all the time

First, this happens intermittently - usually the first time a new model loads but sometimes it happens when I refresh (re-do the model from scratch) and other times it doesn’t. I end up with something like this:

That last item in black is supposed to be linked to the blue item. When I step through the code it always works. I suspect that there is a timing issue. I’m adding all of the nodes before I try to add any of the links but it happens very quickly.

How would I go about troubleshooting this/fixing it when I can’t really step through it?

Thanks.

I can’t see your screenshot. Edit your post and upload an image.

Does the problem happen when you are using go-debug.js?

When it does happen, in the debugger try looking at that Link. Is there a Link at all? What is its actualBounds, and is that about where it should be? If you call isVisible() on that Link, does it return true?