Skip to main content

batch_updates

Function batch_updates 

Source
pub fn batch_updates<F, R>(callback: F) -> R
where F: FnOnce() -> R,
Expand description

Batches signal updates within a closure, deferring DOM synchronization until completion.

Saves the current SUPPRESS_SCHEDULE flag, sets it to true, executes the closure, and restores the previous flag value. This prevents schedule_signal_update from queuing microtasks during the closure execution, allowing multiple signal mutations to be applied before triggering a single DOM update cycle.

§Arguments

  • FnOnce() -> R - The closure to execute with batched updates.

§Returns

  • R - The result of the closure execution.