[]previous and next page

Batching

batch(fn) defers effects until the outermost batch ends, then flushes synchronously.

For agentsUpdated

batch(fn) defers effects until the outermost batch ends, then flushes synchronously. Reads inside a batch are fresh. If fn throws, the effects still flush and the error is rethrown afterward.

flushSync(fn) is batch that also drains effects that were already pending, and returns what fn returns.