collab_client: Redo server message queueing

Move server message queue processing out of `handleUserChanges()` for
the following reasons:
  * Fix a race condition: Before this change the client would stop
    processing incoming messages and stop sending changes to the
    server if a `NEW_CHANGES` message arrived while the user was
    composing a character and waiting for an `ACCEPT_COMMIT` message.
  * Improve readability: The `handleUserChanges()` function is for
    handling changes from the local user, not for handling changes
    from other users.
  * Simplify the code.
This commit is contained in:
Richard Hansen 2021-03-29 02:50:32 -04:00
parent e99fe88537
commit 63a1f078f4
3 changed files with 75 additions and 115 deletions

View file

@ -141,7 +141,7 @@ const Ace2Editor = function () {
this.getDebugProperty = (prop) => info.ace_getDebugProperty(prop);
this.getInInternationalComposition =
() => loaded ? info.ace_getInInternationalComposition() : false;
() => loaded ? info.ace_getInInternationalComposition() : null;
// prepareUserChangeset:
// Returns null if no new changes or ACE not ready. Otherwise, bundles up all user changes