From b44b2b406b2f91d8d7f6f44599a7e2ad7062134c Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Wed, 30 Jul 2025 17:26:38 +0200 Subject: [PATCH] Lazy-loading collection now only increases its version when the total item count changes --- .../Collections/AsyncVirtualObservableReadOnlyList.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/Collections/AsyncVirtualObservableReadOnlyList.cs b/Source/Collections/AsyncVirtualObservableReadOnlyList.cs index 4b96843..3aa4651 100644 --- a/Source/Collections/AsyncVirtualObservableReadOnlyList.cs +++ b/Source/Collections/AsyncVirtualObservableReadOnlyList.cs @@ -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,