core icon indicating copy to clipboard operation
core copied to clipboard

What should I do if I want to watch the entire subtree?

Open Ajamuar opened this issue 4 years ago • 1 comments

In the current documentations of useDocs, there is a mention that it watches the tree up to a given depth. Is there any way we can watch the entire subtree?

Ajamuar avatar Oct 29 '20 10:10 Ajamuar

By "watches", we mean it rerenders the React component where you use useDoc hook, whenever the updates occur until the given depth. Explained in detail here.

If you want to subscribe your component to updates on the whole tree, you can do this

useDoc("", Infinity)

This is not recommended though.

If you just want to observe changes somewhere, not necessarily a React component, you can use observe with depth Infinity.

himanshu-satija avatar Jan 11 '21 10:01 himanshu-satija