Closed raedle closed 3 years ago
Thank you for this detailed issue description. I was finally able to reproduce the issue reliably.
I merged your PR that fixes this issue. I also bumped the dependencies and allowed for current versions of the monaco editor.
The fix is published in y-monaco@0.1.2.
Checklist
Describe the bug Collaboratively editing in Monaco can break the
ITextModel
content (see screencast). It is reproducible if messages sent by the y-websocket are artificially delayed.Note: the
YText
shared data type converges correctly. It's the Monaco editor that's not correctly reflecting the state of the shared type (see second screencast).To Reproduce Steps to reproduce the behavior:
yjs-demos
(cd yjs-demos/demo-server && npm install)
(cd yjs-demos/monaco && npm install)
(cd yjs-demos/demo-server && npm install lib0)
y-websocket/bin/utils.js
toyjs-demos/demo-server/utils.js
y-websocket/bin/callback.js
toyjs-demos/demo-server/callback.js
const setupWSConnection = require('y-websocket/bin/utils.js').setupWSConnection
inyjs-demos/demo-server/demo-server.js
toconst setupWSConnection = require('./utils.js').setupWSConnection
send
inutils.js
in asetTimeout
with 15000 ms (https://github.com/yjs/y-websocket/blob/9fd8f41fa8f1e29e3d98e6de8156b4650a89c7f1/bin/utils.js#L217) to artificially delay sending messages to peer clients.(cd yjs-demos/demo-server && npm start)
WebsocketProvider
inyjs-demos/monaco/monaco.js
to connect to your local websocket server (i.e.const provider = new WebsocketProvider('ws://localhost:8080', 'monaco-demo', ydoc)
(cd yjs-demos/monaco && npm start)
http://localhost:8081/monaco/monaco.html
in both browsersExpected behavior It is expected that both Monaco editors show the same content.
Screenshot
Screencast https://user-images.githubusercontent.com/489051/103810010-583c2400-500f-11eb-99f2-35e58e5c9d70.mp4
Screencast (with
YText
content logged to console) https://user-images.githubusercontent.com/489051/103834425-36a36280-5038-11eb-9456-d528c5c789e7.mp4Environment Information