S
SolidJS14mo ago
Davide

computations created outside a `createRoot` or `render` will never be disposed

I have an onClick event that updates a store, and immediately after, it reads a derived value that depends on the store value. It works correctly, the derived value updates immediately before reading it, but since the derived state produces JSX, I am getting the above error. If I instead don't produce JSX I don't get the error. Ive been having a hard time understanding what is happening and what that error means in this context. Could somebody help me?
4 Replies
Grahf
Grahf14mo ago
I'm curious what the event handler looks like. Does it have a createEffect in it?
lxsmnsyc
lxsmnsyc14mo ago
I would assume you're passing JSX around, which is not a pattern I'd encourage specially since it produces some behavior like the error you're experiencing
Davide
DavideOP14mo ago
Yeah I figured, but what I’m wondering is why? In react it’s pretty normal to have functions return jsx and pass that around
lxsmnsyc
lxsmnsyc14mo ago
well because Solid has no VDOM so basically it's instanciating everything where JSX is declared. JSX in React of course is just a bunch of POJO so it doesn't do anything
Want results from more Discord servers?
Add your server