From 18317d9bb0a66a8ae7a6c20f0741a0c249f0724d Mon Sep 17 00:00:00 2001 From: boatbomber Date: Wed, 31 Jan 2024 14:35:43 -0800 Subject: [PATCH 1/2] Update node metadata using all of the patch, not just updated --- plugin/src/PatchTree.lua | 71 ++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/plugin/src/PatchTree.lua b/plugin/src/PatchTree.lua index e67dbcd0b..10a4c467e 100644 --- a/plugin/src/PatchTree.lua +++ b/plugin/src/PatchTree.lua @@ -426,22 +426,65 @@ function PatchTree.updateMetadata(tree, patch, instanceMap, unappliedPatch) -- Update isWarning metadata for _, failedChange in unappliedPatch.updated do local node = tree:getNode(failedChange.id) - if node then - node.isWarning = true - Log.trace("Marked node as warning: {} {}", node.id, node.name) - - if node.changeList then - for _, change in node.changeList do - if failedChange.changedProperties[change[1]] then - Log.trace(" Marked property as warning: {}", change[1]) - if change[4] == nil then - change[4] = {} - end - change[4].isWarning = true - end - end + if not node then + continue + end + + node.isWarning = true + Log.trace("Marked node as warning: {} {}", node.id, node.name) + + if not node.changeList then + continue + end + for _, change in node.changeList do + if not failedChange.changedProperties[change[1]] then + continue + end + if change[4] == nil then + change[4] = { isWarning = true } + else + change[4].isWarning = true + end + Log.trace(" Marked property as warning: {}.{}", node.name, change[1]) + end + end + for failedAdditionId in unappliedPatch.added do + local node = tree:getNode(failedAdditionId) + if not node then + continue + end + + node.isWarning = true + Log.trace("Marked node as warning: {} {}", node.id, node.name) + + if not node.changeList then + continue + end + for _, change in node.changeList do + -- Failed addition means that all properties failed to be added + if change[4] == nil then + change[4] = { isWarning = true } + else + change[4].isWarning = true end + Log.trace(" Marked property as warning: {}.{}", node.name, change[1]) + end + end + for _, failedRemovalIdOrInstance in unappliedPatch.removed do + local failedRemovalId = if Types.RbxId(failedRemovalIdOrInstance) + then failedRemovalIdOrInstance + else instanceMap.fromInstances[failedRemovalIdOrInstance] + if not failedRemovalId then + continue + end + + local node = tree:getNode(failedRemovalId) + if not node then + continue end + + node.isWarning = true + Log.trace("Marked node as warning: {} {}", node.id, node.name) end -- Update if instances exist From bc87f73115b2d1a58238e8b0d19f78d5c2812ef4 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Wed, 31 Jan 2024 14:37:55 -0800 Subject: [PATCH 2/2] Add comment --- plugin/src/PatchTree.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/src/PatchTree.lua b/plugin/src/PatchTree.lua index 10a4c467e..d68bdcd70 100644 --- a/plugin/src/PatchTree.lua +++ b/plugin/src/PatchTree.lua @@ -438,6 +438,7 @@ function PatchTree.updateMetadata(tree, patch, instanceMap, unappliedPatch) end for _, change in node.changeList do if not failedChange.changedProperties[change[1]] then + -- This change didn't fail continue end if change[4] == nil then