-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Update MauiRecyclerView.cs #30988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update MauiRecyclerView.cs #30988
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR optimizes the UpdateLayoutManager() method in MauiRecyclerView.cs to prevent unnecessary layout manager recreation when the layout hasn't actually changed. The optimization addresses performance issues in KeepScrollOffset mode where frequent layout updates were causing redundant layout manager recreation.
Key Changes
- Added early return check to skip layout updates when the new layout is identical to the current one
- Reordered operations to check layout equality before unsubscribing from property change events
- Updated null check to use modern C# pattern matching syntax
|
Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/backport to release/9.0.1xx-sr9 |
|
Started backporting to release/9.0.1xx-sr9: https://github.com/dotnet/maui/actions/runs/16778712103 |
|
/backport to inflight/candidate |
|
Started backporting to inflight/candidate: https://github.com/dotnet/maui/actions/runs/16788954050 |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
The KeepScrollOffset mode triggered more frequent layout updates as the system attempted to maintain scroll positions during data changes, amplifying the impact of redundant layout manager recreation.
Regressing PR #29447
Issues Fixed
Fixes #30971