solidjs-community / solid-primitives

A library of high-quality primitives that extend SolidJS reactivity.
https://primitives.solidjs.community
MIT License
1.18k stars 114 forks source link

createScriptLoader causes rootless resource error #646

Open apatrida opened 2 weeks ago

apatrida commented 2 weeks ago

Describe the bug

In createScriptLoader the following code:

 setTimeout(() => spread(script, scriptProps, false, true));

causes a warning about doing reactive things outside a root not disposing of resources. Changing to:

 setTimeout(createCallback(() => spread(script, scriptProps, false, true)));

removes the warning.

Minimal Reproduction Link

not-required

atk commented 2 weeks ago

We specifically added the timeout to move the call of spread out of the context, as otherwise hydration breaks. Can you please test your fix in a solid-start app with SSG+hydration?