Skip to content

Fix destroyed components staying in the output when a delayed cleanup errors - #103

Merged
centau merged 2 commits into
centau:mainfrom
kaan650:fix-delayed-destroy-error
Oct 22, 2026
Merged

centau merged 2 commits into
centau:mainfrom
kaan650:fix-delayed-destroy-error

Conversation

@kaan650

@kaan650 kaan650 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

When a component returned with a delay is destroyed and one of its cleanups errors, the timeout callback in switch(), indexes() and values() stops before removing the scope and updating the output. The timeout doesn't run again, so the destroyed component stays in the output for good.

local key = source "a"

local output = switch(key) {
    a = function()
        cleanup(function() error("oops") end)
        return create "Frame" {}, 0.5
    end,
    b = function() return create "Frame" {} end,
}

key "b"
-- 0.5 seconds later the cleanup errors and output() still has both frames

This removes the scope and updates the output before rethrowing the error.

@centau
centau merged commit 673105c into centau:main Oct 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants