It is often useful to only subscribe to the part of a document that interests a particular component and receive changes when they arrive. The VSCode hypermerge editor allows opening & saving sub-documents but doesn't filter updates accordingly.
To determine who to notify, I propose the following strategy:
1) Create a copy of the automerge document that is inverted such that child nodes have links to their parents. Create a dictionary that associates the list with the relevant internal tracking IDs
1b) Change subscribers get attached to particular nodes in this inverted document.
2) When a change arrives, traverse the list of change ops and for each changed ID collect any listeners to that node or to any ancestor nodes.
3) Send a notification to each unique subscriber about the change.
It is often useful to only subscribe to the part of a document that interests a particular component and receive changes when they arrive. The VSCode hypermerge editor allows opening & saving sub-documents but doesn't filter updates accordingly.
To determine who to notify, I propose the following strategy: 1) Create a copy of the automerge document that is inverted such that child nodes have links to their parents. Create a dictionary that associates the list with the relevant internal tracking IDs 1b) Change subscribers get attached to particular nodes in this inverted document. 2) When a change arrives, traverse the list of change ops and for each changed ID collect any listeners to that node or to any ancestor nodes. 3) Send a notification to each unique subscriber about the change.