batch
Edit this pageSolid 2.0 —
batch has been removed in Solid 2.0. Signal updates are now batched by default via microtask scheduling, making explicit batching unnecessary.
What changed
In Solid 1.x, batch was used to group multiple signal updates so downstream computations only ran once. In Solid 2.0, this happens automatically — all signal setter calls batch their downstream updates until the next microtask.
Replacement: flush()
If you need to force synchronous application of pending updates (e.g., to read the DOM immediately after a state change), use flush():
import { flush } from "solid-js"
setCount(1)setText("hello")flush() // synchronously applies all pending updatesflush() should be used sparingly — in most cases, allowing the default microtask batching is preferred.
Migration
// 1.ximport { batch } from "solid-js"batch(() => { setA(1) setB(2) setC(3)})
// 2.0 — just set the signals, batching is automaticsetA(1)setB(2)setC(3)// If you need synchronous flush:flush()