Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate behaviour of parent computation lifecycle vs root dispose #21

Open
JAForbes opened this issue Nov 14, 2022 · 0 comments
Open

Comments

@JAForbes
Copy link
Owner

If you dispose a root, it won't dispose children in a nested root. This rewrite already has this behaviour.

But when a parent computation re-runs any nested computations are destroyed as the parent computation will recreate them.

In this case, what is meant to happen when the parent computation initiates a child root. Does the old child root automatically clean up, or is it meant to be protected?

S.computation(() => { // when this re-runs

  S.root(() => {
    S.computation(() => { // does this get destroyed?
    
    })
  })
})

I think it should be destroyed/recreated because that is how S works at the most basic level, but it seems to make root's less independent than you'd expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant