Is there a rendering cycle documentation/diagram?

Hi, I’m facing an issue with a custom plugin.

I have the need to decorate the content, for that I’m doing my computation in plugin state apply function. Then I return the decoration set as props from the plugin state.

The issue I am facing is for some reason the view is rendered with the previous decorations even if the document has been updated causing failure.

I am wondering is there a rendering cycle documentation, diagram? So then I can get a better understand how the view is composed and understand where I can compute the decorations and when they are consumed.

Thank you in advance for your help :wink:

The plugin state is computed when an updated state is created, and the view update (which uses decorations) is only started when that state is finished. So there’s not really any way for the view redraw to use outdated decorations, and I’d suspect something else is happening.

Thanks for this quick highlight, I’m also suspicious with what I’m seeing, this is a commercial project so I cannot share the code and it is based on tiptap with some custom plugin so would also be tricky to do a repro sandbox :thinking:

In my case I remove one char and I have logs of two render, I json stringify my objects so I’m sure this is not a mutation and the same object. The result is I see my old decoration with the updated doc content, then the updated decoration with the update doc. It is super weird.

We are using y-prosemirror do you have any experience with this? I have the feeling that then it could be related to this syncing between the prosemirror doc and the YDoc. I ran without server connection to be sure I do not have external factor but this is the weird behavior I am observing.

I appreciate your time and if you know some causes that I should check on this would really help me.

Oh one more question, does appendTransaction could cause a second rendering or is it in the same rendering cycle?
Maybe adding a diagram to the api documentation would be super valuable. By the way the api is really well documented and this helped me more than once and thank you for that :wink:

It definitely won’t cause a second rendering—it runs entirely during the state update phase.

y-prosemirror might be part of the issue, I don’t know enough about it to say much there though.