DEV Community

Discussion on: React vs Signals: 10 Years Later

Collapse
 
gaargh profile image
External

OK! Can you explain how this is implemented in Solid? I fail to see what's the purpose of a batch function if you provide a scheduler with such properties.

Thread Thread
 
gaargh profile image
External

@dan_abramov Your take?

Thread Thread
 
ryansolid profile image
Ryan Carniato

It was because Solid's current version batches synchronously which means we need to have the ability to wrap it so it knows to run at the end. Reactive execution (like reacting to a signals change) does this automatically but we don't currently wrap async entry points like events. This is a very rarely used API and even VDOM libraries like Inferno have the same immediate behavior in event handlers. We will autobatch into a microtask queue in these cases in the future (which is what Vue does), but it was a something I did early on imitating some of the fastest libraries.