Skip to content

Commit

Permalink
Fix for #619. don't report property deletes as changes when they have…
Browse files Browse the repository at this point in the history
… already happened
  • Loading branch information
KevinJump committed Apr 16, 2024
1 parent 432d74c commit 7d1860e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions uSync.Core/Tracking/SyncRootMergerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ public static (XElement combined, XElement differences) CompareNodes(List<XEleme

foreach (var node in nodes[..^1])
{
// if the later node is a delete/rename, it always wins
// there is nothing to merge
if (node.IsEmptyItem())
return (node, BlankNode(differences));

// if this node is the same as the differences we already have,
// return it.
if (node.ToString() == differences.ToString())
return (combined, BlankNode(differences));

// workout any merged diffrences,
(combined, differences) = GetTrackedNodeDifferences(node, combined, trackedNodes);
}
return (combined, differences);
Expand Down Expand Up @@ -152,8 +160,13 @@ private static (XElement combined, XElement diffrence) GetMultipleChanges(Tracki
else
{
var replacement = FindByKey(combinedCollection, element, item.Keys, key);
replacement?.AddAfterSelf(targetElement);
replacement?.Remove();

// only add this if its not a delete
if (targetElement.Attribute("deleted").ValueOrDefault(false) is false)
{
replacement?.AddAfterSelf(targetElement);
}
replacement?.Remove();
}
}

Expand Down

0 comments on commit 7d1860e

Please sign in to comment.