Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after 2 users type simultaneously in collab editor #342

Open
Albert-Jan opened this issue Jun 12, 2020 · 1 comment
Open

Error after 2 users type simultaneously in collab editor #342

Albert-Jan opened this issue Jun 12, 2020 · 1 comment

Comments

@Albert-Jan
Copy link
Contributor

Hi all! Currently working on a collab editor with Zefyr but everytime 2 users are typing simultaneously it crashes. However when the two devices type separately everything works as expected.

Steps to Reproduce

  1. Create a socket.io which emits changes
  2. Have 2 people type simultaneously
  3. Both editors go out of sync, and edits are not displayed anymore on the other device

My code

Following code is where the log points to:

socket.on('editor_change', (data) {
      Map list = json.decode(data);
      ChapterChange change = ChapterChange.fromMap(list);
      if (change.user != uniqueId) {
        Delta delta = Delta.fromJson(json.decode(change.change));
        _controller.compose(delta, source: ChangeSource.remote);
      }
    });

Logs

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: 'package:notus/src/document/node.dart': Failed assertion: line 237 pos 12: 'index == 0 || (index > 0 && index < length)': is not true.
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
#2      ContainerNode.insert (package:notus/src/document/node.dart:237:12)
#3      NotusDocument.compose (package:notus/src/document.dart:231:15)
#4      ZefyrController.compose (package:zefyr/src/widgets/controller.dart:87:17)
#5      _EditorPageState.initState.<anonymous closure> (package:editor/test.dart:83:21)
#6      EventEmitter.emit.<anonymous closure> (package:socket_io_common/src/util/event_emitter.dart:52:14)
#7      List.forEach (dart:core-patch/growable_array.dart:282:8)
#8      EventEmitter.emit (package:socket_io_common/src/util/event_emitter.dart:51:11)
#9      Function._apply (dart:co<…>
Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.5 19F101, locale en-NL)
    • Flutter version 1.17.3 at
      /Users/albertjanp/Documents/Development/Software/flutter
    • Framework revision b041144f83 (8 days ago), 2020-06-04 09:26:11 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4
@kwestlund
Copy link

kwestlund commented Jun 12, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants