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
#621)

* Fix for #619. don't report property deletes as changes when they have already happened

* Add fix for #620 - don't recreate items that are deleted.
  • Loading branch information
KevinJump committed Apr 17, 2024
1 parent 1786b16 commit 08f4392
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion uSync.Core/Tracking/SyncRootMergerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public static (XElement combined, XElement differences) CompareNodes(List<XEleme
var differences = XElement.Parse(nodes[^1].ToString());
var combined = XElement.Parse(nodes[^1].ToString());

// latest is a blank one, that is a delete so should
// be marked as one.
if (combined.IsEmptyItem())
return (combined, BlankNode(differences));

foreach (var node in nodes[..^1])
{
if (node.ToString() == differences.ToString())
Expand Down Expand Up @@ -149,7 +154,12 @@ private static (XElement? combined, XElement? diffrence) GetMultipleChanges(Trac
else
{
var replacement = FindByKey(combinedCollection, element, item.Keys, key);
replacement?.AddAfterSelf(targetElement);

// 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 08f4392

Please sign in to comment.