mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor PatchTree and applyPatch for improved readability and logic consistency
- Restructured property change checks in PatchTree.build to enhance clarity and maintainability. - Updated applyPatch to improve the handling of instance retrieval logic for removed instances. - Simplified the findDuplicateNames function in diff.lua for better readability and consistency in handling duplicate names.
This commit is contained in:
parent
d21331cb65
commit
cd05690d8a
3 changed files with 38 additions and 36 deletions
|
|
@ -29,7 +29,9 @@ local function applyPatch(instanceMap, patch)
|
|||
|
||||
for _, removedIdOrInstance in ipairs(patch.removed) do
|
||||
-- Skip auto-created instances that shouldn't be synced
|
||||
local instance = if Types.RbxId(removedIdOrInstance) then instanceMap.fromIds[removedIdOrInstance] else removedIdOrInstance
|
||||
local instance = if Types.RbxId(removedIdOrInstance)
|
||||
then instanceMap.fromIds[removedIdOrInstance]
|
||||
else removedIdOrInstance
|
||||
if instance and Config.ignoredClassNames[instance.ClassName] then
|
||||
continue
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ local function isEmpty(table)
|
|||
end
|
||||
|
||||
-- Finds duplicate names among children and returns a set of names that are duplicated
|
||||
local function findDuplicateNames(children: { Instance } | { string }, virtualInstances: { [string]: any }?): { [string]: boolean }
|
||||
local function findDuplicateNames(
|
||||
children: { Instance } | { string },
|
||||
virtualInstances: { [string]: any }?
|
||||
): { [string]: boolean }
|
||||
local nameCounts: { [string]: number } = {}
|
||||
local duplicates: { [string]: boolean } = {}
|
||||
|
||||
|
|
@ -411,10 +414,7 @@ local function diff(instanceMap, virtualInstances, rootId)
|
|||
|
||||
-- Log count of skipped duplicates
|
||||
if skippedDuplicateCount > 0 then
|
||||
Log.warn(
|
||||
"Skipped {} location(s) with duplicate-named siblings (cannot reliably sync)",
|
||||
skippedDuplicateCount
|
||||
)
|
||||
Log.warn("Skipped {} location(s) with duplicate-named siblings (cannot reliably sync)", skippedDuplicateCount)
|
||||
end
|
||||
|
||||
if not diffSuccess then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue