mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Build tree ancestry correctly (#882)
This commit is contained in:
parent
5f51538e0b
commit
edf87bf9a3
1 changed files with 3 additions and 5 deletions
|
|
@ -163,8 +163,7 @@ function Tree:buildAncestryNodes(previousId: string?, ancestryIds: { string }, p
|
|||
-- Build nodes for ancestry by going up the tree
|
||||
previousId = previousId or "ROOT"
|
||||
|
||||
for i = #ancestryIds, 1, -1 do
|
||||
local ancestorId = ancestryIds[i]
|
||||
for _, ancestorId in ancestryIds do
|
||||
local value = instanceMap.fromIds[ancestorId] or patch.added[ancestorId]
|
||||
if not value then
|
||||
Log.warn("Failed to find ancestor object for " .. ancestorId)
|
||||
|
|
@ -200,7 +199,7 @@ function PatchTree.build(patch, instanceMap, changeListHeaders)
|
|||
end
|
||||
|
||||
-- Gather ancestors from existing DOM
|
||||
local ancestryIds, ancestryIndex = {}, 0
|
||||
local ancestryIds = {}
|
||||
local parentObject = instance.Parent
|
||||
local parentId = instanceMap.fromInstances[parentObject]
|
||||
local previousId = nil
|
||||
|
|
@ -211,8 +210,7 @@ function PatchTree.build(patch, instanceMap, changeListHeaders)
|
|||
break
|
||||
end
|
||||
|
||||
ancestryIndex += 1
|
||||
ancestryIds[ancestryIndex] = parentId
|
||||
table.insert(ancestryIds, 1, parentId)
|
||||
knownAncestors[parentId] = true
|
||||
parentObject = parentObject.Parent
|
||||
parentId = instanceMap.fromInstances[parentObject]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue