SolidJSS
SolidJSโ€ข12mo agoโ€ข
5 replies
MikeM42

createRoot with libraries?

I have a very strange behaviour that I can't really explain. I've been building a library in which is a plugin to the rete (retejs.org) library, as part of this I have to manage component lifecycle for which I use createRoot.
The strange thing is, that createRoot prevents Components from inside the library to trigger "computation created outside a 'createRoot'..." but it doesn't prevent the same if I create a child component outside the library in main code.

So if I have something like the following that gets created under a createRoot call:

<div>
  <Component1/> # From library
  <Component2/> # Not from library
<div>


Then Component2 creation triggers the "computation..." issue.

If I put all of the library code inside of the same app (so its not a library anymore), then everything works without triggering the error, but if I build the library and then use it, I trigger the issue.
The issue can be found in this example https://github.com/mmoerman/solid-rete-plugin-examples, under the example "Example With Button Control".
The library for the rete plugin is here: https://github.com/mmoerman/solid-rete-plugin

I feel that this is somehow related to how Javascript handles library contexts, but don't have enough experience with Javascript to figure out what the issue might be and how to solve it.
GitHub
A SolidJS plugin for Rete (https://retejs.org/). Contribute to mmoerman/solid-rete-plugin development by creating an account on GitHub.
GitHub - mmoerman/solid-rete-plugin: A SolidJS plugin for Rete (htt...
Was this page helpful?