I still don’t have an isolated example - it’s difficult to reproduce the bug outside of my full codebase, but I have made some progress identifying the problem. I’ve also implemented a hacky fix, by forking history.js (from prosemirror-history) into my project.
applyTransaction in that file, there is a big if/else-if/else, the last branch of which, as I understand it, handles adding
addToHistory === false transactions.
Those transactions can’t simply be discarded because they might alter document mappings. So
mapRanges(history.prevRanges, tr.mapping), history.prevTime)
I discovered that if I didn’t update history with
tr.mappings, everything started working properly again. i.e. if I simply return the original history object passed in to
(my hacky fix is to do this when the problematic transaction is detected, using a metadata property)
The reason this looks like a bug to me is that, as mentioned above, the transaction in question only contains
setNodeMarkup operations. Can those lead to changed mappings? I would have thought not.
Is there enough here to help narrow down the bug?