devagr
Explore posts from serversUnderstanding `createRoot`
you'd rarely need to use
createRoot
yourself, because it's done automatically under the hood of things like <Show
and <For
for example a <Show
component creates a root and renders the children inside it. If the when
condition changes, it will dispose that root, and create a new one to render the fallback.
if it changes again, it disposes the fallback root and creates a new one for the children.19 replies
Understanding `createRoot`
this is why you can just create reactive stuff inside components without every having to worry about unsubscribing/disposing like you do with other reactive systems like rxjs.
roots are first class mechanisms to track everything created inside a function scope and dispose them all together.
unowned
scope basically means that there is nothing keeping track of what you create, so if you create reactive stuff it will basically live forever19 replies
Understanding `createRoot`
let's get a little more basic.
taking the example of rxjs. when you subscribe to something with rxjs, you get a subscription object back with a method to dispose the subscription
without owners, the equivalent in solid would look like this
this level of manual disposal is easy to forget to do, you'll see a bunch of articles around this topic in angular+rxjs land. Every subscription you create needs to be manually disposed.
Roots fix this by inverting control
Now everything created inside the root will dispose automatically when you dispose the root.
19 replies
Understanding `createRoot`
createMemo
and createEffect
create an owned scope. every reactive primitive will create an owned reactive scope. the unowned scopes will be the logic outside of components in the global scope, in event handlers, and anything async (like promise.then)19 replies
CCConvex Community
•Created by devagr on 4/3/2025 in #support-community
`convex dev` can't reach server
yeah got back on regular wifi and the issue is gone
44 replies
CCConvex Community
•Created by devagr on 4/3/2025 in #support-community
`convex dev` can't reach server
no worries i'm completely fine with waiting it out
44 replies
CCConvex Community
•Created by devagr on 4/3/2025 in #support-community
`convex dev` can't reach server

44 replies
CCConvex Community
•Created by devagr on 4/3/2025 in #support-community
`convex dev` can't reach server

44 replies
CCConvex Community
•Created by devagr on 4/3/2025 in #support-community
`convex dev` can't reach server

44 replies
CCConvex Community
•Created by devagr on 4/3/2025 in #support-community
`convex dev` can't reach server
i'll wait for the wifi to get back on and report back
44 replies
CCConvex Community
•Created by devagr on 4/3/2025 in #support-community
`convex dev` can't reach server

44 replies
CCConvex Community
•Created by devagr on 4/3/2025 in #support-community
`convex dev` can't reach server
why would it work up until a few hours ago then
44 replies