maui icon indicating copy to clipboard operation
maui copied to clipboard

Update mappers instead of replacing field values

Open mattleibow opened this issue 1 year ago • 1 comments

Description of Change

Update mappers instead of replacing field values to prevent field/type reference ordering to influence the way mappers are set.

Currently we assume that UseMauiApp is the first part of MAUI that updates the mappers, however we can directly influence that very easily:

// load Core mappers
ElementHandler.ElementMapper.GetKeys();
ViewHandler.ViewMapper.GetKeys();
ButtonHandler.Mapper.GetKeys();

// then load Controls mappers
Button.ControlsButtonMapper.GetKeys();
Element.ControlsElementMapper.GetKeys();
VisualElement.ControlsVisualElementMapper.GetKeys();

By first forcing all the Core types to load, the Controls mappers are not correctly set up to handle changes later on. Because we first load Button.ControlsButtonMapper and then Element.ControlsElementMapper, the properties in Element are not available to Button.

This PR removes the need for ordering and makes sure that Button is chained to Element so we can ADD to Element and Button automatically gets the new properties.

Context: https://github.com/dotnet/maui/issues/11662#issuecomment-1464361623

Issues Fixed

Fixes #11662

Tasks

  • [ ] Code
    • [ ] Application.RemapForControls();
    • [ ] VisualElement.RemapForControls();
    • [ ] Label.RemapForControls();
    • [ ] Button.RemapForControls();
    • [ ] CheckBox.RemapForControls();
    • [ ] DatePicker.RemapForControls();
    • [ ] RadioButton.RemapForControls();
    • [ ] FlyoutPage.RemapForControls();
    • [ ] Toolbar.RemapForControls();
    • [ ] Window.RemapForControls();
    • [ ] Editor.RemapForControls();
    • [ ] Entry.RemapForControls();
    • [ ] Picker.RemapForControls();
    • [ ] SearchBar.RemapForControls();
    • [ ] TabbedPage.RemapForControls();
    • [ ] TimePicker.RemapForControls();
    • [ ] Layout.RemapForControls();
    • [ ] ScrollView.RemapForControls();
    • [ ] RefreshView.RemapForControls();
    • [ ] Shape.RemapForControls();
    • [ ] WebView.RemapForControls();
  • [ ] Tests

mattleibow avatar Mar 10 '23 22:03 mattleibow

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

github-actions[bot] avatar Mar 10 '23 22:03 github-actions[bot]

🚨 API change(s) detected @davidbritch FYI

ghost avatar Mar 23 '23 22:03 ghost

/rebase

mattleibow avatar Mar 28 '23 16:03 mattleibow

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

github-actions[bot] avatar Apr 06 '23 23:04 github-actions[bot]

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

github-actions[bot] avatar Apr 07 '23 17:04 github-actions[bot]

Just the one flyout header not collapsing test that passes locally... CI hates it for some reason. Not sure if some event is not firing or there is now a longer delay. But it passes locally. Almost impossible to debug.

Might need to add some screenshots.

mattleibow avatar Apr 28 '23 11:04 mattleibow

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

github-actions[bot] avatar May 04 '23 16:05 github-actions[bot]

I will start mapper docs here: https://github.com/dotnet/maui/pull/16296

Still need to figure out the best way...

🧑‍🤝‍🧑

mattleibow avatar Jul 21 '23 22:07 mattleibow