There isn't a lot of accessible and straightforward information about how createRoot works, why it exists, and when it should be used. To my knowledge, it's a relatively advanced topic, and there is rarely a need to use it. I don't have a specific use case for it either, but I wanted to update the documentation, so I need to understand it better first. Specifically, I want to address this issue.
Here are my questions; please provide simple explanations:
- Why is it named
createRoot? Root of what?
Creates a new non-tracked owner scope that doesn't auto-dispose. From the Solid docs.
- What is an owner scope? What is the difference between an owned scope and an unowned scope?
All Solid code should be wrapped in one of these top level as they ensure that all memory/computations are freed up. From the Solid docs.
-
What are the sources of memory and computations that need to be freed up? What problems can arise if they are not freed?
-
Can you provide an example of how the
detachedOwnerprop could be useful? -
Can you provide a practical example of using
createRootwith code?
Since this is an advanced topic and I want to ensure accuracy for the documentation, I'm tagging a few individuals who I believe might be knowledgeable about this to draw their attention. I typically do not do this. @rare fog @graceful comet @half elk @radiant falcon