NodeView duplicate rendering among many decorations

I’ve recorded the following demonstration of our problem:

It seems related to having many inline decorations in succession to create the colored underlining.

In this screenshot, you can see that our “search item” (expression-node-view) is being rendered in two spots despite only having the expression-token node in one place in the structure.

Any ideas?

Hi. This is likely an issue in ProseMirror’s view tree update logic (or also potentially an API misuse that confuses that logic). But as you say, there’s a lot going on in your editor. I understand that reproducing it in a minimal setup is going to be hard, but that would be extremely helpful. Do you have a reliable route to reproduce this? Have you looked how far you can minimize the document, and which features you can turn off, to have it still reproduce?

Failing that, it would be useful to figure out which part of the view update code is to blame here. If you add a console.log(`child ${child} in ${this.node}@${pos}`) in the second arrow function passed to iterDeco in NodeViewDesc.updateChildren, and check if the duplicated node is coming by twice there, that would tell us if the problem is in iterDeco or further downstream in the ViewTreeUpdater.

Thanks for the quick reply, we’ll take a look at trying to reproduce with minimal functionality, so the issue is easier to track down.