Short summary
The Yjs/Monaco collaboration binding is torn down and rebuilt on every keystroke because content (the live file text) is incorrectly listed as a useEffect dependency.
Steps to reproduce
- Open any existing playground that has collaboration enabled.
- Open a file in the editor.
- Start typing in the Monaco editor.
- Open the Network tab in browser DevTools.
- Observe repeated requests to
/api/collab-token firing on every keystroke.
- (Optional) Open the playground in two browser tabs — observe collaborator cursors flickering or disappearing while typing.
Expected behavior
The Yjs binding should be established once when the file or playground changes, and remain stable throughout the editing session. Typing should not trigger any network requests or re-initialise the binding.
Actual behavior
Every keystroke causes the useEffect in playground-editor.tsx (lines 274–413) to re-run because content is in the dependency array. This destroys the existing MonacoBinding, fetches a new collab token, and creates a new binding — dozens of times per second while typing. Collaborator cursors flicker and disappear.
Affected area
Playground editor
Environment
Any browser on any OS running Editron locally or deployed. Reproducible whenever a playground is open and the user types in the editor.
Screenshots, logs, or recordings
No response
Confirmation
Short summary
The Yjs/Monaco collaboration binding is torn down and rebuilt on every keystroke because
content(the live file text) is incorrectly listed as auseEffectdependency.Steps to reproduce
/api/collab-tokenfiring on every keystroke.Expected behavior
The Yjs binding should be established once when the file or playground changes, and remain stable throughout the editing session. Typing should not trigger any network requests or re-initialise the binding.
Actual behavior
Every keystroke causes the
useEffectinplayground-editor.tsx(lines 274–413) to re-run becausecontentis in the dependency array. This destroys the existingMonacoBinding, fetches a new collab token, and creates a new binding — dozens of times per second while typing. Collaborator cursors flicker and disappear.Affected area
Playground editor
Environment
Any browser on any OS running Editron locally or deployed. Reproducible whenever a playground is open and the user types in the editor.
Screenshots, logs, or recordings
No response
Confirmation