mweidner037 / list-positions-demos

Demos using the list-positions and list-formatting libraries.
19 stars 2 forks source link

Is there a bug in the handler of receiving mutations? #16

Open etclub opened 3 weeks ago

etclub commented 3 weeks ago

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

[mutations from other clients, local pending mutations, mutations from other clients]
mweidner037 commented 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.