Change not within a transaction: !m points:


I have this (which is the points of a link)

    "x": -51.02928,
    "y": 414.85002
    "x": -41.02928,
    "y": 414.85002
    "x": 169.48537499999998,
    "y": 414.85002
    "x": 169.48537499999998,
    "y": 432.3333633333333
    "x": 380.0000299999999,
    "y": 432.3333633333333
    "x": 390.0000299999999,
    "y": 432.3333633333333

I tried to pass it as is and to pass it with .flatMap(p => [p.x,p.y])

But I always have this issue

Change not within a transaction: !m points: [nouvelle valeur périmètre stock] Node1  old: -51.02928,2119.1500200000005,-41.02928,2119.1500200000005,174.48537499999998,2119.1500200000005,174.48537499999998,2157.0000300000006,390.0000299999999,2157.0000300000006,400.0000299999999,2157.0000300000006  new: List()#12379

You should be able to set (either directly or via a Binding) the Link.points property to that Array. Link | GoJS API
So you don’t need to call Array.flatMap.

I don’t understand the title for this topic: “Binding error: undefined target property: size”. What does “size” have to do with this?

That warning about a change happening outside of a transaction just tells you that something is being changed between transactions and will be included in the next transaction. I don’t know what you are doing when you get that warning, but maybe you are setting some link routes without conducting a transaction.


Sorry for the title, I have copied the wrong line … I have changed the title.
Ok so it’s juste a transaction error. I was thinking that as long the old / new are differently written, something was wrong

Have you an example on how to do it in a transaction ?

Here is what I do

schema.layout = applyLayout(); 


function applyLayout() {
  return go.GraphObject.make(go.LayeredDigraphLayout, {
    // isInitial: false,
    // isOngoing: false,
    iterations: 100,
    direction: 0,
    setsPortSpots: true,
    layerSpacing: 150,
    columnSpacing: 10,
    alignOption: go.LayeredDigraphLayout.AlignAll

All of the predefined layouts conduct transactions when moving nodes and routing links. How and when are you setting Link.points?

I get Link.points from a db call
On init of the diagram I pass the data and bind them
If the diagram needs to pass in the auto layout then the schema.layout is assigned
After if the user wants to run it by hand he can, and it runs the same code

OK, so you have a data Binding of the Link.points property that looks like: new go.Binding("points"), and your model includes Arrays of x,y data.

That should not cause those warnings. Perhaps you are receiving the points data asynchronously? Remember that all changes should be made during a single transaction.

Yes I have new go.Binding('points').makeTwoWay(),,
All of the data arrives at the same time

I have the error when the user wants to update re-run the layout

What code do you execute when the user wants to rerun the layout?

This code is exectued

Where schema is the instance of go.Diagram

Try wrapping a transaction around that code.
See for example what the buttons do in Fishbone Layout

This is the new code

schema.startTransaction("force layout");
schema.layout = applyLayout(); 
schema.groupTemplateMap = getGroupTemplateMap(applyLayout);
schema.commitTransaction("force layout");

It seems that I have less trace

But now the remainings are

Change not within a transaction: !d points: UUID old: List()#78358 new: List()#79985

Where UUID is the key
I can’t find why…

Shouldn’t you be changing the template(s) before forcing a layout to happen?

No because the actual thing is that we have metadata from the template stored in database (sometime)
In this case the user might want to re-run the layout

But changing template(s) will automatically cause a layout to happen. Again, in your case.

Do your new templates show Pictures that do not have a desiredSize (width and height) set to real numbers, so that nodes change size? I’m wondering if the asynchronous loading of images might cause those recomputation of link routes.

Yes there is
What can I do in that case, pass them as svg ?

Can you specify their width and height? Basically fixing their size ahead of time. It’s the same problem with the loading of images in HTML – the recommendation is to set the width and height to avoid frequent page layouts.