Integrating GoJs with Oracle Jet

Hi,
We are evaluating the gojs library by trying to integrate it with Oracle JET
When we try to do so we are facing the below issues.
We are using the following cdn in index.html
<script src="https://unpkg.com/gojs/release/go-debug.js"></script>
In our Oracle Jet component,
We created a div and when we try to access that particular div using the below script
script:
var myDiagram = new go.Diagram("myDiagramDiv");
Html:
<div id="myDiagramDiv" style="width:400px; height:150px; background-color: #DAE4E4;"></div>
The whole code looks like this,

import { h, Fragment } from "preact";
declare global {
  interface Window {
    go: any;
  }
}

export function GoJsEval() {
  const go = window.go;
  var myDiagram = new go.Diagram("test")
  return (
    <div
      id="test"
      style="width:400px; height:150px; background-color: #DAE4E4;"
    ></div>
  );
}

We are not able to access the div using the id and we are getting the below error:

.js:13 Uncaught (in promise) Error: Invalid DIV id; could not get element with id: test
  at C (go.js:13:71)
  at vi (go.js:604:284)
  at new Q (go.js:591:400)
  at _.GoJsEval [as constructor] (goJsEval.tsx:28:19)
  at _.N [as render] (index.js:518:14)
  at I (index.js:181:12)
  at w (children.js:137:3)
  at I (index.js:198:4)
  at w (children.js:137:3)
  at z (index.js:404:4)

Our requirement is to create a topology viewer that describes the architecture diagrams.
Can anyone help us on evaluating the GoJs library with Oracle Jet Framework by resolving the above errors and create a toplology viewer as mentioned above?

We don’t have any experience with Oracle Jet. But it seems like you need to make sure the div exists before trying to associate a GoJS Diagram with it.

In other frameworks, that is typically done via constructing the Diagram after some lifecycle event or hook has occurred.

1 Like

Hi @jhardy ,
Thank You. I have fixed that issue just some time before. Wrapped the code inside useeffect hook.
So, Do you provide support for using GoJs with Oracle Jet if we plan to use licensed GoJs in our Oracle Jet Application ?

We can provide support for anything relating to the GoJS library, but don’t have enough knowledge of Jet to support framework-related questions.

Okay, Thank You