scottvorthmann
Context not working as expected
FWIW, I resolved my problem. It was not another instance. It was due to the fact that I destructured props in my provider component, since I don't need reactivity there. Since I accessed
props.children
in that destructuring, it created the children too early.15 replies
Context not working as expected
If I set breakpoints in my context provider and at the call to
useContext
, the latter gets hit first... I can't explain that any other way. Solid will render children, then create the parent, then add the children to the parent, right?15 replies
Context not working as expected
I'm having a similar problem. I was expecting to use context for accessing a webworker, with the component rendering pass setting up some infrastructure. However, the context is always the default value during the component rendering... context really only works for pure data that can be reactive. The provider does not get initialized until after its children have been rendered, so they'll always render as if there were no outer context available.
I can't simply use global state instead of context, since I do need a webworker per root.
15 replies
solid-three
Here is where I put some log statements to see what was happening:
https://github.com/ryansolid/dom-expressions/blob/21fdba5bcab25986a2b93003aaace100b2231cdc/packages/babel-plugin-jsx-dom-expressions/src/shared/transform.js#L167
79 replies
solid-three
That looks like a templated message coming from
solid-three
, which is trying to do things like attach a geometry to a mesh, and it is trying to work on DOM elements. Same problem as before, just a different manifestation. I think your compile is never matching the DOMElements
condition, and always compiling to universal
. Try to figure out how to attach a debugger to the compile step, or just hack some console.log()
into the plugin. I tracked down the right line of code last week, let's see if I can remember how I did that.
I'm assuming, here, that your actual root render()
call is using solid-js/web
... that was my initial error, if you recall.79 replies