Skip to content

Commit 1f01776

Browse files
authored
Handle strings and instances in patch removes for visualizer (rojo-rbx#713)
When an object is deleted in a patch, it is either represented with an ID or an Instance. On initial sync, removals are instances since the map does not contain those instances. Later removals of managed objects use an ID. The patch visualizer only handled instances, so this fixes that. Closes rojo-rbx#710.
1 parent 7a799ea commit 1f01776

File tree

1 file changed

+9
-1
lines changed
  • plugin/src/App/Components/PatchVisualizer

1 file changed

+9
-1
lines changed

plugin/src/App/Components/PatchVisualizer/init.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local Packages = Rojo.Packages
77
local Roact = require(Packages.Roact)
88
local Log = require(Packages.Log)
99

10+
local Types = require(Plugin.Types)
1011
local PatchSet = require(Plugin.PatchSet)
1112
local decodeValue = require(Plugin.Reconciler.decodeValue)
1213
local getProperty = require(Plugin.Reconciler.getProperty)
@@ -240,7 +241,14 @@ function PatchVisualizer:buildTree(patch, instanceMap)
240241
})
241242
end
242243

243-
for _, instance in patch.removed do
244+
for _, idOrInstance in patch.removed do
245+
local instance = if Types.RbxId(idOrInstance) then instanceMap.fromIds[idOrInstance] else idOrInstance
246+
if not instance then
247+
-- If we're viewing a past patch, the instance is already removed
248+
-- and we therefore cannot get the tree for it anymore
249+
continue
250+
end
251+
244252
-- Gather ancestors from existing DOM
245253
-- (note that they may have no ID if they're being removed as unknown)
246254
local ancestry = {}

0 commit comments

Comments
 (0)