mirror of
https://github.com/centau/vide.git
synced 2026-10-23 05:46:26 +00:00
Fix destroyed components staying in the output when a delayed cleanup errors (#103)
Co-authored-by: centau <83140718+centau@users.noreply.github.com>
This commit is contained in:
parent
a75e3ee843
commit
673105c51a
4 changed files with 59 additions and 3 deletions
|
|
@ -101,9 +101,10 @@ local function indexes<K, V, Obj>(
|
|||
scope.value = nil -- set to nil for the `scope.value ~= v` check
|
||||
if scope.timeout == nil then
|
||||
scope.timeout = timeout(scope.delay, function() -- todo: possible redundant updates
|
||||
scope.destroy()
|
||||
local ok, err = pcall(scope.destroy)
|
||||
scopes[i] = nil
|
||||
update_output()
|
||||
if not ok then error(err, 0) end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -50,9 +50,10 @@ local function switch_map<K, Obj>(
|
|||
else
|
||||
if scope.timeout == nil then
|
||||
scope.timeout = timeout(scope.delay, function()
|
||||
scope.destroy()
|
||||
local ok, err = pcall(scope.destroy)
|
||||
scopes[k] = nil
|
||||
update_output()
|
||||
if not ok then error(err, 0) end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -111,9 +111,10 @@ local function values<K, V, Obj>(
|
|||
scope.index = nil -- set to nil for the `scope.index ~= i` check
|
||||
if scope.timeout == nil then
|
||||
scope.timeout = timeout(scope.delay, function() -- todo: possible redundant updates
|
||||
scope.destroy()
|
||||
local ok, err = pcall(scope.destroy)
|
||||
scopes[v] = nil
|
||||
update_output()
|
||||
if not ok then error(err, 0) end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue