Hi Marijn,
I’ve encountered what appears to be an issue with transform.map during table operations. Here’s a minimal reproduction:
Scenario:
Initial document contains a table with two cells
Client X performs: Adjusts column width of the second cell
Client Y performs: Deletes the second cell and inserts new content
After rebase, it generates an invalid ReplaceAroundStep
Result:
Creates an empty td (content-less table cell) in the document
Throws error: “Invalid content for node type table_cell”
Demo:
https://codesandbox.io/p/sandbox/2fztcm?file=%2Fsrc%2Findex.js%3A10%2C28
By the way, prior to upgrading, I was using prosemirror-transform@1.1.3 where this issue did not occur.
1 Like
marijn
August 2, 2025, 3:52pm
2
I don’t see the error you mention, neither in the codesandbox link nor when I try to run that code locally. Is anything else needed to make the issue show up?
Correction to My Previous Description:
Apologies for the confusion in my initial report. As you can see from the console output in the demo:
The steps.length is 4
The final step is an invalid ReplaceAroundStep
The doc contains an invalid td node
Regarding the "Invalid content for node type table_cell" error:
This error only surfaces in the view layer when clicking into the table
The demo doesn’t explicitly trigger this error (it occurs during user interaction)
marijn
August 4, 2025, 8:16am
4
Are you able to set up a demo that reproduces this directly, so that I can see it happen?
I’ve updated the demo, could you please take another look?
marijn
August 6, 2025, 9:33pm
6
Thanks, that made it easy to track this down. It was indeed a problem in the library—ReplaceAroundStep could, in some circumstances, be applied even if it produced an invalid node. This patch should help.
committed 09:32PM - 06 Aug 25 UTC
FIX: Fix a bug in `Slice` that made it possible for invalid `ReplaceAroundStep`s… to
be applied in some situations.
See https://discuss.prosemirror.net/t/potential-issue-with-transform-map-in-table-operations/8511
2 Likes