mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Fix recursive batch() use
This commit is contained in:
parent
65fe3fcf47
commit
8eb5f96c5b
5 changed files with 75 additions and 16 deletions
|
|
@ -73,4 +73,22 @@ read can still be tracked inside a reactive scope.
|
|||
function read<T>(value: T | () -> T): T
|
||||
```
|
||||
|
||||
## batch()
|
||||
|
||||
Runs a given function where any source updates made within the function do not
|
||||
trigger effects until after the function runs.
|
||||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
function batch(fn: () -> ())
|
||||
```
|
||||
|
||||
- **Details**
|
||||
|
||||
Improves performance when an effect depends on multiple sources, and those
|
||||
sources need to be updated. Updating those sources inside a batch call will
|
||||
only cause the effect to run once after the batch call ends instead of after
|
||||
each time a source is updated.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue