diff --git a/CHANGELOG.md b/CHANGELOG.md index ef3b525..01f2dd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). of the condition. - Ignore `false` passed as a child. - Flag `vide.defaults` to disable the setting of default properties. +- Delayed scope destruction for control flow functions: `show()` `switch()` `indexes()` `values()`. ### Changed diff --git a/src/implicit_effect.luau b/src/implicit_effect.luau index 5332662..7dbd2f7 100644 --- a/src/implicit_effect.luau +++ b/src/implicit_effect.luau @@ -23,6 +23,7 @@ local function update_parent_effect(p: { return p end +-- todo: investigate if "count" method used in indexes() and values() can improve performance here local function update_children_effect(p: { instance: Instance, cur_children_set: { [Instance]: true }, @@ -39,6 +40,7 @@ local function update_children_effect(p: { if new_children_set[child] then return end -- stops redundant reparenting new_children_set[child] = true -- record child set from this update + if not cur_children_set[child] then child.Parent = p.instance -- if child wasn't already parented then parent it else @@ -85,7 +87,9 @@ return { property = property, source = source }) + evaluate_node(node) + return node end, @@ -94,7 +98,9 @@ return { instance = instance, source = parent }) + evaluate_node(node) + return node end,