Skip to content

Commit 589ee85

Browse files
committed
If no updates during SetValue(), return
If a call to `SetValue()` doesn't have `markDirty` or `version` set, and an existing `TrackedRecord<>` exists with the same `Value`, then don't create and store a new record; instead, just return, as there's nothing to update here. This is a minor performance improvement, since there's no reason to create a new instance of a `TrackedRecord<>` here. Notably, this impacts `Refresh()`, `Rollback()`, and the OnTopic Editor.
1 parent 3cf5ab0 commit 589ee85

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

OnTopic/Collections/Specialized/TrackedRecordCollection{TItem,TValue,TAttribute}.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ internal void SetValue(
461461
else if (originalItem.Value != value) {
462462
markAsDirty = true;
463463
}
464+
else if (!version.HasValue) {
465+
return;
466+
}
464467
updatedItem = originalItem with {
465468
Value = value,
466469
IsDirty = markAsDirty,

0 commit comments

Comments
 (0)