From af8d1e8b24ced1e9f07f63605a02ceba8a903158 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Sat, 8 Jul 2023 13:21:48 -0700 Subject: [PATCH] Handle strings and instances --- plugin/src/App/Components/PatchVisualizer/init.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/src/App/Components/PatchVisualizer/init.lua b/plugin/src/App/Components/PatchVisualizer/init.lua index 95673dfe7..a751f2ffd 100644 --- a/plugin/src/App/Components/PatchVisualizer/init.lua +++ b/plugin/src/App/Components/PatchVisualizer/init.lua @@ -7,6 +7,7 @@ local Packages = Rojo.Packages local Roact = require(Packages.Roact) local Log = require(Packages.Log) +local Types = require(Plugin.Types) local PatchSet = require(Plugin.PatchSet) local decodeValue = require(Plugin.Reconciler.decodeValue) local getProperty = require(Plugin.Reconciler.getProperty) @@ -240,7 +241,14 @@ function PatchVisualizer:buildTree(patch, instanceMap) }) end - for _, instance in patch.removed do + for _, idOrInstance in patch.removed do + local instance = if Types.RbxId(idOrInstance) then instanceMap.fromIds[idOrInstance] else idOrInstance + if not instance then + -- If we're viewing a past patch, the instance is already removed + -- and we therefore cannot get the tree for it anymore + continue + end + -- Gather ancestors from existing DOM -- (note that they may have no ID if they're being removed as unknown) local ancestry = {}