Diagram nodes not shown on canvas sometimes. Not even logging any error in console

Hi,
In my application, GoJS diagram renders on clicking a link.
Sometimes nodes are not rendered with no error logged in console
On redoing twice or thrice the click action, am able to see the nodes.
This issue is coming up rarely and rest of the times diagram is being loaded on first click only.
I am using new go.GraphLinksModel(nodeDataArray, linkDataArray) to render the diagram on click of the link.
I tried debugging the issue and found the nodes and link info in diagram model but the diagram is not shown on canvas.
Can you please help be resolve the issue?

Does the Diagram’s HTML DIV element change size during initialization? Please read Resizing Diagrams -- Northwoods Software.

Hi Walter, I found sometimes logging the below error message

Error: Cannot make a Group a member of itself: Group#2389 .....

In the nodeDataArray, none of the node entries have both ‘key’ and ‘group’ value same. What could be the possible cause for the issue.

I tried calling Diagram.requestUpdate also. However, I feel like this is not about DIV element size issue.

Ah, it’s good that you’re paying attention to possible errors.

It’s true that it would be an error if you had a node data object whose key and group properties were the same value. But it would also be a problem if G1 were a member of G2 that was a member of G1. Or any situation that had such a membership cycle.

I checked that way also… I couldn’t find any such cycle in the nodeDataArray.

Attaching the nodeDataArray -

[
  {
    "isGroup": true,
    "key": "request_in",
    "__gohashid": 211
  },
  {
    "isGroup": true,
    "key": "request_out",
    "__gohashid": 212
  },
  {
    "key": "source",
    "portId": "source",
    "group": "request_in"
  },
  {
    "key": "source:VTI_SAMPLE_PRODUCT",
    "portId": "source:VTI_SAMPLE_PRODUCT",
    "parent": "source",
    "group": "request_in"
  },
  {
    "key": "source:VTI_SAMPLE_PRODUCT:fields",
    "portId": "source:VTI_SAMPLE_PRODUCT:fields",
    "parent": "source:VTI_SAMPLE_PRODUCT",
    "group": "request_in"
  },
  {
    "key": "source:VTI_SAMPLE_PRODUCT:DELETED:",
    "portId": "source:VTI_SAMPLE_PRODUCT:DELETED:",
    "parent": "source:VTI_SAMPLE_PRODUCT:fields",
    "group": "request_in"
  },
  {
    "key": "target",
    "portId": "target",
    "group": "request_out"
  },
  {
    "key": "target:VTI_SAMPLE_PRODUCT",
    "portId": "target:VTI_SAMPLE_PRODUCT",
    "parent": "target",
    "group": "request_out"
  },
  {
    "key": "target:VTI_SAMPLE_PRODUCT:fields",
    "portId": "target:VTI_SAMPLE_PRODUCT:fields",
    "parent": "target:VTI_SAMPLE_PRODUCT",
    "group": "request_out"
  },
  {
    "key": "target:VTI_SAMPLE_PRODUCT:DELETED:",
    "portId": "target:VTI_SAMPLE_PRODUCT:DELETED:",
    "parent": "target:VTI_SAMPLE_PRODUCT:fields",
    "group": "request_out"
  }
]

Here, there are only two groups with no cycle…

I agree – there’s no membership cycle there. I just created a GraphLinksModel using that nodeDataArray, and the diagram displayed well without any errors or warnings.

Yes. I am also able to see the diagram rendered with the above data but not always…
Sometimes needed multiple calls to render the diagram, then only 'm able to see it.

This issue is seen only sometimes but not everytime.
The data is same every time. Eventhough sometimes the diagram is not loading…

Well, that’s very odd. What asynchrony do you have regarding how you load the data and how you update the model?