Open etclub opened 3 weeks ago
It assumes that the log is always [mutations from other clients, local pending mutations]
. Local pending mutations are always those that have not yet been acknowledged by the server, so they are necessarily later in the log than all mutations received from the server. (I.e., once the server adds them to its own log, they will be later.)
If you allowed mutations from other clients to be received over some side-channel that doesn't use the server, then those mutations would also need to be kept in the "pending" array until confirmed by the server.
At https://github.com/mweidner037/list-positions-demos/blob/master/websocket-prosemirror-log/src/site/prosemirror_wrapper.ts#L384, it assumes that the received mutations could match those in local pending mutations at the beginning.
But is it possible that the received mutations are something like