Repository navigation
Extract InfiniteScrollList business logic into InfiniteScrollListViewModel - #7240
Merged
Merged
Conversation
jebriede
marked this pull request as draft
March 27, 2026 23:43
…Model, establishing MVVM pattern with XAML bindings and unit tests
jebriede
force-pushed
the
dev-jebriede-RefactorInfiniteScrollList
branch
from
May 11, 2026 21:26
ec36876 to
5636200
Compare
jebriede
marked this pull request as ready for review
May 13, 2026 01:10
jeffkl
previously approved these changes
May 18, 2026
Nigusu-Allehu
previously approved these changes
May 19, 2026
martinrrm
previously approved these changes
May 19, 2026
martinrrm
left a comment
Contributor
There was a problem hiding this comment.
Approving since this is just moving code and you will address the issues in a later PR; I'm just adding some comments in case they are helpful for the next PR
jebriede
dismissed stale reviews from martinrrm, Nigusu-Allehu, and jeffkl
via
May 19, 2026 23:18
2ca035c
Nigusu-Allehu
approved these changes
May 19, 2026
martinrrm
approved these changes
May 20, 2026
Merged
1 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Fixes: https://github.com/NuGet/Client.Engineering/issues/3700
Description
Extract InfiniteScrollList business logic into InfiniteScrollListViewModel
Summary
Extracts all business logic from
InfiniteScrollList.xaml.cs(860 lines) into a newInfiniteScrollListViewModel(714 lines), reducing the codebehind to ~200 lines of WPF-specific plumbing. The ViewModel has no WPF type references and is fully unit-testable.This is the first step in addressing https://github.com/NuGet/Client.Engineering/issues/2539 (business logic in codebehind). Further improvements are tracked in https://github.com/NuGet/Client.Engineering/issues/3702
Design decisions
HasUpdatablePackages(notIsUpdateContainerVisible),HasSelectedPackages(notIsUpdateEnabled),SelectionState(notSelectAllChecked),IsUpdateMode(notCheckBoxesEnabled)LoadingStatusBar.Reset()/SetError()/SetCancelled()replace their ownDataContextwith new objects — fundamentally imperative, can't be XAML bindings. Delegates are wired in the constructor (notLoaded) becausePackageManagerControlcallsLoadItemsAsyncduring initializationTopLevelPackageCount/TransitivePackageCountstay on the codebehind: They useCollectionViewGroup.ItemCountwhich reflects filtered counts. LINQ-based counts on the ViewModel would show unfiltered totals — wrong when vulnerability filter is activePackageManagerControlaccesses_packageList.ViewModeldirectly: Eliminates passthrough properties on the control. Both types are internal to the same assemblyBooleanToVisibilityConverterandBooleanToHiddenVisibilityConverterfromResources.xamlinstead of defining new onesTesting
New unit tests in
InfiniteScrollListViewModelTests.cscovering:LoadItemsAsyncparameter validation and cancellationHasTransitiveItemsdetectionResolveSelectedItem: by ID, not found, nullShouldShowStatusBarfor cancelled/error/ready/null statesPre-existing issue found
Group header package counts (
TopLevelPackageCount/TransitivePackageCount) intermittently show 0 when the vulnerability filter is active. This is a pre-existing bug ondev— the plain CLR getters have no change notification mechanism, andCollectionViewGroupmay not be fully rebuilt when the binding re-evaluates. Tracked separately.PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.