Code breaks after Angular 16 upgrade

I’ve upgraded to Angular 16 and now my gojs diagram breaks when adding a new shape to the diagram.

It breaks here
` public diagramModelChange(changes: go.IncrementalData): void {
// when setting state here, be sure to set skipsDiagramUpdate: true since GoJS already has this update
// (since this is a GoJS model changed listener event function)
// this way, we don’t log an unneeded transaction in the Diagram’s undoManager history

const appComp = this;
this.state = produce(this.state, draft => {
  // set skipsDiagramUpdate: true since GoJS already has this update
  // this way, we don't log an unneeded transaction in the Diagram's undoManager history
  draft.skipsDiagramUpdate = true;
  draft.diagramNodeData = DataSyncService.syncNodeData(changes, draft.diagramNodeData, appComp.observedDiagram.model) as any;
  draft.diagramLinkData = DataSyncService.syncLinkData(changes, draft.diagramLinkData, appComp.observedDiagram.model as any) as any;
  draft.diagramModelData = DataSyncService.syncModelData(changes, draft.diagramModelData) as any;


  // If one of the modified nodes/links was the selected node used by the inspector, update the inspector selectedNodeData object
  const modifieDatas = changes.modifiedNodeData || changes.modifiedLinkData;
  if (modifieDatas && draft.selectedNodeData) {
    for (const data of modifieDatas) {
      const nodeKeyProperty = appComp.myDiagramComponent.diagram.model.nodeKeyProperty as string;
      if (data[nodeKeyProperty] === draft.selectedNodeData[nodeKeyProperty]) {
        draft.selectedNodeData = data;
      }
    }
  }
});

`

specifically it breaks on the line :

draft.diagramNodeData = DataSyncService.syncNodeData(changes, draft.diagramNodeData, appComp.observedDiagram.model) as any;

with the error TypeError: Cannot read properties of undefined (reading '23') , which does not help much…

I have also upgraded immer.js to version 10 (was on 9 before).

I’m on gojs 2.3.1 and gojs-angular 2.0.6

Can you let me know if something needs changing or if gojs-angular is not compatible with these packages ? My code was working just fine before the upgrade, so I’m not doing anything wrong here.

ah, downgrading immer.js from 10 to 9 actually solves the issue.

Can you look into fixing this ?

Immer version 10 explicitly removes support for ES5 browsers. They say that you should not upgrade to Immer v10 if you want to maintain support for ES5.

Version 3 of GoJS will also remove support for ES5 browsers. But that won’t be released for a while.