mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Enhance ancestry node handling in PatchTree
- Added logic to create a placeholder node when an ancestor object is missing from both instanceMap and patch.added, allowing the ancestry chain to maintain integrity during rapid changes. - Improved logging to provide context when a placeholder node is created, enhancing debugging capabilities.
This commit is contained in:
parent
a1dfc2b7ef
commit
da320e36eb
1 changed files with 13 additions and 1 deletions
|
|
@ -183,7 +183,19 @@ function Tree:buildAncestryNodes(previousId: string?, ancestryIds: { string }, p
|
|||
|
||||
local value = instanceMap.fromIds[ancestorId] or patch.added[ancestorId]
|
||||
if not value then
|
||||
Log.warn("Failed to find ancestor object for " .. ancestorId)
|
||||
-- Ancestor is missing from both instanceMap and patch.added.
|
||||
-- This can happen during rapid changes (e.g., undo operations) where
|
||||
-- patches arrive referencing instances that were never fully synced.
|
||||
-- Create a placeholder node to maintain the ancestry chain, allowing
|
||||
-- the visualization to still work with incomplete information.
|
||||
Log.warn("Failed to find ancestor object for {}; creating placeholder node", ancestorId)
|
||||
self:addNode(previousId, {
|
||||
id = ancestorId,
|
||||
className = "Unknown",
|
||||
name = "[Unknown Ancestor]",
|
||||
instance = nil,
|
||||
})
|
||||
previousId = ancestorId
|
||||
continue
|
||||
end
|
||||
self:addNode(previousId, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue