mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
fix recursive queue flush
This commit is contained in:
parent
b85419088c
commit
1eab1aa598
3 changed files with 51 additions and 20 deletions
|
|
@ -6,17 +6,18 @@ local graph = require(script.Parent.graph)
|
|||
|
||||
local function batch(setter: () -> ())
|
||||
local already_batching = flags.batch
|
||||
local flush
|
||||
|
||||
flags.batch = true
|
||||
if not already_batching then
|
||||
flags.batch = true
|
||||
flush = graph.flush_update_queue()
|
||||
end
|
||||
|
||||
local ok, err: string? = pcall(setter)
|
||||
|
||||
if not already_batching then
|
||||
flags.batch = false
|
||||
|
||||
if not already_batching then
|
||||
graph.flush_update_queue()
|
||||
end
|
||||
flush()
|
||||
end
|
||||
|
||||
if not ok then throw(`error occured while batching updates: {err}`) end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue