MudColorPicker: Use ParameterState#10357
Conversation
7a1e3d8 to
f0738ba
Compare
|
@versile2 @danielchalmers does anyone wants to tests before I merge this? i didn't find problems vs current version. |
There was a problem hiding this comment.
Pull request overview
This PR migrates MudColorPicker to use the ParameterState pattern to avoid direct parameter mutations. The changes include refactoring the base MudPicker<T> class to support ParameterState through virtual proxy methods (ReadText/WriteTextAsync), and converting MudColorPicker to manage all its parameters (Value, Text, ShowAlpha, ColorPickerView, ThrottleInterval) through registered ParameterState instances. Several public API methods (SetR, SetG, SetB, SetH, SetS, SetL, SetAlpha, SetInputString, ChangeView) were either removed or changed to private/async variants, constituting breaking changes.
Key changes:
- Introduction of ParameterState management for component parameters to prevent direct parameter mutations
- Conversion of public setter methods to private async variants that work through ParameterState
- Addition of
MudColor.Emptystatic field and nullable support inMudColorComparer
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/MudBlazor/Utilities/MudColor.cs |
Added MudColor.Empty static field, reordered equality operators, and updated MudColorComparer to support nullable types |
src/MudBlazor/Components/Picker/MudPicker.razor.cs |
Added virtual proxy methods (ReadText, WriteTextAsync, WriteValueAsync) to support ParameterState in derived classes, made _elementId readonly, changed TextChanged to nullable |
src/MudBlazor/Components/Picker/MudPicker.razor |
Updated text binding to use split getter/setter syntax with proxy methods |
src/MudBlazor/Components/ColorPicker/MudColorPicker.razor.cs |
Implemented ParameterState pattern with registration for all parameters, converted public setters to private async methods, added change handlers for parameter updates |
src/MudBlazor/Components/ColorPicker/MudColorPicker.razor |
Updated all bindings to use ParameterState values and async setter methods |
src/MudBlazor.UnitTests/Components/ColorPickerTests.cs |
Updated tests to use GetState() extension method for accessing ParameterState values |
src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/SimpleColorPickerTest.razor |
Extracted inline lambda into named method for TextChanged event handler |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
|
is it laggy on your end? Docs: Recording.2025-11-23.172515.mp4this branch on WasmHost: Recording.2025-11-23.172431.mp4 |
No, looks smooth like on first gif? Try to run without debugger? |
Description
Part of progression to stop violating our new rules to not write to components parameters.
Some methods were made private as I don't see point to expose them
Type of Changes
Checklist
dev).