Incremental JSON emit order

I type really fast Cmd+Z and Cmd+Y, to stress test the Incremental JSON saving performance,

it will be emit the Incremental JSON , in almost case.

  1. insertNodes […]
  2. removeNodes […]
  3. insertNodes […]
  4. removeNodes […]

But sometimes I received the Incremental JSON strange order, that is,

  1. removeNodes […]
  2. insertNodes […]
  3. insertNodes […]
  4. removeNodes […]

Could you confirm it is possible ?
Maybe model change event is not stable ordering ?

for guarantee order I am using promise.then(…), even so it happens.

What do you mean by “receive the Incremental JSON”?

receive the Incremental JSON” at server side.

I mean, removeNodes […] came first, it actually, insertNodes happens first.

Are you sending messages in separate TCP connections? The messages can arrive out-of-order.

I think same as you The TCP reordering, but now I use Promise to sent incre. JSON to server. then send next.

That doesn’t change anything. Messages sent in different TCP connections can arrive in any order.

Normally the receiver of any sequence of messages will sort them into an acceptable ordering.

Thank you, I let me more dig in to this.

By the way the promise implement i refer this page

so I think, It is send one Json to the server, sever respond , then send next JSON to server, so it not possible TCP reorder it. If you feel , Gojs not possible emit event in different order, that is fine, i research my code more.

I don’t know how you are communicating with the server, but it seems highly likely that you chose a protocol that is asynchronous. You aren’t waiting for an answer before sending the second message, are you? So you sent msg #1 and then msg #2, but then it is possible for the server to receive #2 and then #1.

Yes it is my Promise code bug. I already fixed it, thank you walter!
now it no problem with my crazy fast Cmd+Z and Cmd+Y. no order problem!