xaviergonz / mobx-keystone

A MobX powered state management solution based on data trees with first class support for Typescript, support for snapshots, patches and much more
https://mobx-keystone.js.org
MIT License
549 stars 25 forks source link

[ undoMiddleware] not possible to group implicit Reference removal actions #202

Closed airtonix closed 3 years ago

airtonix commented 3 years ago

Regarding: https://github.com/xaviergonz/mobx-keystone/issues/150#issuecomment-750711035

Removal of nodes that have back references results in more than one patch, meaning undoManager.undo requires multiple calls to restore a node and its references.

Since the references get removed by virtue of the node not existing any more, would something like wrapping my action that removes the node in a transaction decorator help here?

xaviergonz commented 3 years ago

Thanks for reporting, could you try v0.48.4? It should be fixed there.

xaviergonz commented 3 years ago

Closing since in theory it is fixed. Feel free to reopen if not