The batch function allows you to combine multiple signal writes into one single update that is triggered at the end when the callback completes.
When you access a signal that you wrote to earlier inside the callback, or access a computed signal that was invalidated by another signal, we’ll only update the necessary dependencies to get the current value for the signal you read from. All other invalidated signals will update at the end of the callback function.
Batches can be nested and updates will be flushed when the outermost batch call completes.