Recomputing gutter heights for line widgets

Hi everyone,

I have a widget decoration that displays variable values, e.g. JSON objects. It functions as a line widget, i.e. it is considered as part of the line, it should shift down the lines after it.

It is implemented like this:

toDOM(view: EditorView) {
    let wrapper = document.createElement("div");
    ReactDOM.createRoot(wrapper).render(
      <ReactJson src={this.value} name={null} collapsed />
    );
    return wrapper;
  }

It looks like this:

image

As you can see, the height of the gutter in line 1 is incorrect. It is only updated when I click line 2. That also occurs when expanding/collapsing the tree nodes in the widget. How can I force recomputing the gutter heights when the content of the widget changes?

Thank you in advance!

You can call EditorView.requestMeasure to ask the view to measure its content again when something changes dynamically.

Thank you very much! What should I pass to requestMeasure?

… Nothing!

Cool, thank you for your help!