KEMBAR78
Update MauiRecyclerView.cs by kubaflo · Pull Request #30988 · dotnet/maui · GitHub
Skip to content

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Aug 1, 2025

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

@Copilot Copilot AI review requested due to automatic review settings August 1, 2025 23:24
@kubaflo kubaflo requested a review from a team as a code owner August 1, 2025 23:24
Copy link
Contributor

@Copilot Copilot AI left a 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

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Aug 1, 2025
@dotnet-policy-service
Copy link
Contributor

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.

@PureWeen
Copy link
Member

PureWeen commented Aug 2, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho rmarinho changed the base branch from main to inflight/current August 6, 2025 08:44
@rmarinho rmarinho merged commit a3488e1 into dotnet:inflight/current Aug 6, 2025
127 of 129 checks passed
@rmarinho rmarinho added this to the .NET 9 SR10 milestone Aug 6, 2025
@PureWeen
Copy link
Member

PureWeen commented Aug 6, 2025

/backport to release/9.0.1xx-sr9

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2025

Started backporting to release/9.0.1xx-sr9: https://github.com/dotnet/maui/actions/runs/16778712103

@PureWeen
Copy link
Member

PureWeen commented Aug 6, 2025

/backport to inflight/candidate

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2025

Started backporting to inflight/candidate: https://github.com/dotnet/maui/actions/runs/16788954050

github-actions bot pushed a commit that referenced this pull request Aug 7, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android CarouselView with KeepScrollOffset - Data template initialized too many times

3 participants