Lazy-loading collection now only increases its version when the total item count changes

This commit is contained in:
Markus Ewald 2025-07-30 17:26:38 +02:00
parent 246c90f7c8
commit b44b2b406b

View File

@ -811,11 +811,13 @@ namespace Nuclex.Avalonia.Collections {
if(fetchedItemCount < this.pageSize) { if(fetchedItemCount < this.pageSize) {
itemCount = offset + fetchedItemCount; itemCount = offset + fetchedItemCount;
lock(this) { lock(this) {
if(itemCount < this.assumedCount) {
this.assumedCount = itemCount; this.assumedCount = itemCount;
} #if DEBUG
#if DEBUG
++this.version; ++this.version;
#endif #endif
}
}
} }
// The count may have been adjusted if this truncated the list, // The count may have been adjusted if this truncated the list,