Decoration.map is empty after setNodeMarkup

I have a table node with some decorations. But after I use tr.setNodeMarkup, the decorations.map is empty. is this expected. what should I do

setNodeMarkup replaces the node’s start token, which will clear node decorations on it, which might be what you’re seeing here.

setNodeMarkup is really used to the table, So it means that the setNodeMarkup and the decorations have a same pos, so decorations is deleted, which is corrected.