Fix recursive batch() use

This commit is contained in:
Aaron Smith 2023-11-20 12:27:56 +00:00
parent 65fe3fcf47
commit 8eb5f96c5b
5 changed files with 75 additions and 16 deletions

View file

@ -11,13 +11,15 @@ local function batch(setter: () -> ())
local ok, err: string? = pcall(setter)
flags.batch = false
if not ok then throw(`error occured while batching updates: {err}`) end
if not already_batching then -- todo: flush anyways?
graph.flush_update_queue()
if not already_batching then
flags.batch = false
if not already_batching then
graph.flush_update_queue()
end
end
if not ok then throw(`error occured while batching updates: {err}`) end
end
return batch