Lexical version: 0.33.1
Steps To Reproduce
- Register a mutation/update listener which triggers another editor update.
- Register a mutation listener which calls
editor.read()
- Do an action which triggers the first mutation/update listener.
Example failing test: 635cb9665
The current behavior
The read() from the second mutation listener calls $commitPendingUpdates which triggers update listeners. However, update listeners from the first update may not have not yet been called. This can lead to corruption of the Yjs document.
The expected behavior
Update listeners are called in-order and Yjs is not corrupted.
Impact of fix
For Yjs specifically, these updates being called out of order can lead to data loss or complete failure to load the document (Expected shared type to include type attribute).
Acknowledge that triggering an update from an update listener is an anti-pattern, but reporting this anyway given the impact.