#592·yjs

Merge transactions in undo manager

Author: SebastianStehleCreated Oct 29, 2023Updated Dec 28, 2025
Labelsenhancement

Checklist

[ ] Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/ [ ] Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/

Is your feature request related to a problem? Please describe. I am using yjs for a diagram editor or I am working on the integration of yjs into this editor. In my editor the selection state is also part of the model and I would like to ignore that in the undo redo operations, or to be more precise, it should not be added to the stack.

Lets consider a very basic example with 2 transactions and the initial state 0:

  1. Diagram has item A and B, B is selected.
  2. User selects A now
  3. User adds item C, which gets selected automatically.

Describe the solution you'd like If I just ignore transaction, then A would be selected after undo operation, which is not the same state as before. Therefore what I would like to achieve is that the transaction 1 is ignored but added to the undo stack after transaction 2 is completed.

Describe alternatives you've considered I think I can also implement it on top of the undo manager or implement it by adding additional metadata to the stack item as described in the docs, but I think this makes the most sense for me

Additional context Add any other context or screenshots about the feature request here.

Huly®: YJS-403