fix recursive queue flush

This commit is contained in:
alice 2024-08-15 01:51:17 +02:00 committed by centau
parent b85419088c
commit 1eab1aa598
3 changed files with 51 additions and 20 deletions

View file

@ -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