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) {
itemCount = offset + fetchedItemCount;
lock(this) {
this.assumedCount = itemCount;
if(itemCount < this.assumedCount) {
this.assumedCount = itemCount;
#if DEBUG
++this.version;
#endif
}
}
#if DEBUG
++this.version;
#endif
}
// The count may have been adjusted if this truncated the list,