-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Improve performance and stability of BindableLayout
#23136
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
/azp run |
ba17b89
to
b366f0d
Compare
Azure Pipelines successfully started running 3 pipeline(s). |
https://github.com/dotnet/maui/pull/23136/checks?check_run_id=28884287267 mentions a test failure that might be a real change in behavior: Microsoft.Maui.TestCases.Tests.Issues.Issue22417(Windows).AddItemsToCarouselViewWorks VisualTestUtils.VisualTestFailedException : More info: https://aka.ms/visual-test-workflow |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Now I can see this test to fail:
Not sure if it is a real issue but looks like it can. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Faling unrelated tests:
|
Tests appear to be green now. |
/rebase |
baa4aa2
to
9c4e849
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
I see a change in the BindableLayout behaviour 8.0.90, which may or may not be related to this, but I wanted to report it:
Before the update, the layout was redrawn and reapplied the settings (in my case colors) that were hardcoded in XAML, after the update, the content gets updated, but the changes to layout items (such as colors) persist. I managed to resolve the issue by adding a
before setting the item source. I just wanted to report it in case it was an unintentional breaking change. |
@cagriy you're correct, this was an intentional breaking change, and your workaround is correct. BindableLayout is now trying to reuse the views as much as possible considering that creating a platform view from scratch has higher cost than changing a few binded property. One thing you could do instead of the |
@albyrock87 , that's fantastic, and thanks for the quick reply, would it be a good idea to move this change into the breaking changes section so that others won't need to troubleshoot the same issue? |
Description of Change
This PR improves the performance of
BindableLayout
in all cases where the item source changes entirely or there is aReset
orReplace
event (see more on #23135).The strategy is simple: reuse existing views when possible, and simply change the
BindingContext
.Video - Before
Video - After
Issues Fixed
Fixes #23135