Understanding Events on observeDeep

@Manuelbaun Manuel Baun
Fri, 10 Apr 2026 15:15:18 +0000

Hi Kevin,

thank you for the hard work you and your team done on YJS.
i try to understand how to utilize the observeDeep and its events.
i have a doc, and on the doc a map nodes. nodes have basically this schema

type RectNodeSchema = {
    id: string;
    label: string;
    type: "rect";
    //...
    style: {
        fill?: string | undefined;
        stroke?: string | undefined;
        //..
    };
};

RectNode is a YMap and Style is a nested YMap as well.

in a transaction, I update 2 nodes with the same color on style.fill

  this.nodes.observeDeep((events, transaction) => {

now on observeDeep, I get 2 events.
the first event has a path of nodeid, and style,
the second even has just path of style (no nodeid.)

thats it.

I cannot make any sense of it. is that a bug, or expected to be, why are there 2 events, and only the first node has a path of nodeid and style.

where is the information of the 2nd node update? why just style, nothing else.

if i update 3 nodes at the same time, I get 3 events.

the same concept, first event, has nodeid, style, 2. event, just style, so is the 3rd event.

basically I want to update my doc, then on those updates I want to rerender my app. and only those parts. how can I make sense of those events?