You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Top level effects (createEffect that isn't wrapped in a createRoot) behave inconsistently when compared with effects under a root, because top level effects aren't batched.
This isn't an issue with solid per se, as its render function already wraps in a root.
The issue is when solid is used for reactivity exclusively(besides rendering dom nodes), such when creating long-lived effects that will never be disposed, reactivity in the server; or for demo purposes (such playground snippets and the like), this inconsistency gets in the way because doesn't match expectations, it could be hard to understand why does behave this way.
It is possible that batching top level effects improve the performance of these effects.
Describe the bug
Top level effects (
createEffect
that isn't wrapped in acreateRoot
) behave inconsistently when compared with effects under a root, because top level effects aren't batched.This isn't an issue with solid per se, as its
render
function already wraps in aroot
.The issue is when solid is used for reactivity exclusively(besides rendering dom nodes), such when creating long-lived effects that will never be disposed, reactivity in the server; or for demo purposes (such playground snippets and the like), this inconsistency gets in the way because doesn't match expectations, it could be hard to understand why does behave this way.
It is possible that batching top level effects improve the performance of these effects.
Your Example Website or App
meaw
Steps to Reproduce the Bug or Issue
Top level effect non batched
https://playground.solidjs.com/anonymous/39d404d1-5c4a-411b-ab85-f915c82089e6
behaves differently to:
effect wrapped in a root
https://playground.solidjs.com/anonymous/d30de401-fc16-4c9a-a247-39333b970b8b
behaves the same as a top level effect that uses batch
https://playground.solidjs.com/anonymous/13b29236-c0f9-46fb-8b20-4a221fa9e4df
Expected behavior
Please batch top level effects.
Screenshots or Videos
No response
Platform
Additional context
As discussed on discord, it may be about changing this line https://github.com/solidjs/solid/blob/main/packages/solid/src/reactive/signal.ts#L357
The text was updated successfully, but these errors were encountered: