Issues after upgrading GoJS from 2.3.5 to 3.x

Hi Team, We are trying to upgrade GoJS to 3.x. Once we upgrade, we are getting a few console errors & UI is not getting loaded.

Error:

Uncaught TypeError: Cannot read properties of undefined (reading ‘fill’)
at Bi.PO (go.mjs:18:126843)
at Bi.bb (go.mjs:18:125957)
at Ft.getPositions (go.mjs:13:82493)
at je.routeLinks (go.mjs:56:153196)
at Ft.doLinkRouting (go.mjs:13:77066)
at Ft.ZL (go.mjs:13:78853)
at Ft.CM (go.mjs:13:78014)
at Ft.br (go.mjs:13:23642)
at Ft.maybeUpdate (go.mjs:13:22834)
at go.mjs:13:22757

UI: Loading State: Loading Graph Data

Could you help here?

Precisely which version 3 library are you using to get that stack trace? I hope it is the latest.

Have you read the changelog about the minor incompatibilities version 3 introduced? Change Log | GoJS

Yes, we are using the latest version (3.0.19). We are using the routing property on the Link shape which returns

function getValue(go) {
return go.Link.AvoidsNodes;
}

Do we need to update this @walter ? What will be the change here? I see a few changes have been made in 3.0.10.

For version 3.0 we reorganized the code to support more generalized link routers. The Router for AvoidsNodes routing is built into the library for compatibility.

Try using the go-debug.mjs library to see if it reports any problems with your code.

Is there any way for you to give us a minimal stand-alone reproducible case for us to debug it?

Hi, @walter I tried using the routing property in the GoJS sample but, didn’t face any issues. But, in our diagram, we are getting the below error & diagram is not loaded. We have used this property in one place in the Link node.

Could you please have a look & let me know?

I have no idea. You don’t provide the information I would need to guess.

I do recommend using the debug library during development.

@walter

function getValue(go) {
return go.Link.AvoidsNodes;
}

The above one is valid even after 3.x upgradation right?

In our instance, we are getting a loading error with the above property, right?

Who to point go-debug.mjs? We are fetching it using npm. Could you please point me us how to map go-debug.mjs???

Yes, GoJS v3 compatibly implements the older enumerated value names. So for example Link.AvoidsNodes === Routing.AvoidsNodes.

What is your import statement in each of your source files that involves the GoJS library?

What JavaScript framework and build tools are you using, and which versions? I believe all of the recent ones automatically make use of the package.json declarations specifying which library file to use for different situations, including whether you are building for development or for production.

@walter, I think I can use the debug version now. Here is the error. Could you please have a look?

This code is quite old, so it would be surprising if there were a new bug.

Have you overridden Node.getAvoidableRect?

Could you answer my previous questions, to address your other question?

No @walter, we didn’t use getAvoidableRect in our code.

We are importing GoJS as below:

import * as go from ‘gojs’;

We are installing GoJS by mentioning GoJS version in package.json.

Node: 16.X
NPM: 9.19.4

You are importing the “go” namespace, so I do not understand why “go” is a parameter of your getValue function.

Ignore the above getValue() related code.

This is how we are forming the Link Template @walter

new go.Link({
routing: go.Link.AvoidsNodes,
cursor: ‘pointer’,
relinkableFrom: true,
relinkableTo: true,
reshapable: true,
},
});

Yes, that’s fine in either 2.3 or 3.0.

But diagram is not loading after we upgrade to 3.0.19.

I still don’t have enough information to be able to debug that.

First, when using go-debug.mjs, are there any warnings or errors in the console that might give a clue about a problem?

Second, can you provide a minimal stand-alone reproduction of the problem? How can we reproduce the problem?

Hi @walter, We didn’t find any other errors or warnings besides this error.

Tried to reproduce a stand-alone problem but was not able to do it. It’s working there as expected.

Are there any diagrams/models for which the error does not happen?

Can you successfully update to 2.3.19?

Not tried with 2.3.19. We are currently on 2.3.5 & moving to 3.0.19

Well, at least update to 2.3.19.