Apply generic types for Combo Change event. Fix silent error for Change event when using T=int. - #358
Apply generic types for Combo Change event. Fix silent error for Change event when using T=int.#358skrustev wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Ignite UI for Blazor Combo wrapper to strongly-type the Change event arguments using the combo’s generic type parameter, and adjusts the interop marshalling pipeline so keyed selection values can round-trip correctly (including T=int which previously failed silently).
Changes:
- Made
IgbCombo<T>.ChangeuseEventCallback<IgbComboChangeEventArgs<T>>, withDetail.NewValuenow typed asT[]. - Updated marshalling/return-value conversion to construct generic combo event args/details and to better transform arrays before downcasting.
- Expanded unit coverage for keyed-value scenarios across
int,double, andstringkeys.
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 |
|---|---|
| tests/IgniteUI.Blazor.Tests/ComboTests.cs | Refactors keyed-value contract tests into a generic base and adds coverage for int/double/string key values. |
| src/componentsBase/MarshalByValueFactory.cs | Adds a generic CreateInstance<T> so combo change event args/details can be created with the correct generic type. |
| src/componentsBase/BaseRendererElement.cs | Adds generic overloads for conversion helpers and propagates generic conversion to the root control. |
| src/componentsBase/BaseRendererControl.cs | Improves array transformation/downcast behavior and routes marshal-by-value creation through generic factory. |
| src/components/Blazor/ComboChangeEventArgsDetail.cs | Makes NewValue strongly typed (T[]) and deserializes it via ReturnToObjectArray<T>. |
| src/components/Blazor/ComboChangeEventArgs.cs | Makes Detail strongly typed (IgbComboChangeEventArgsDetail<T>) and converts via ConvertReturnValue<T>. |
| src/components/Blazor/Combo.cs | Updates Change event callback type to the new generic event args and propagates typed value updates. |
Suppressed comments (1)
tests/IgniteUI.Blazor.Tests/ComboTests.cs:357
ComboValueKeyStringTestsshould override the value-key name to useStringIdso the test exercises the string-key path rather than still using the default "Id" key.
public class ComboValueKeyStringTests : ComboValueKeyTestsBase<string>
{
protected override string EventKeyValue => "\"UK02\"";
protected override string ExpectedKeyValue => "UK02";
protected override string[] PropValues => ["UK01", "UK03"];
protected override string ExpectedValue => """["UK01", "UK03"]""";
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Works fine, but since it changes part of the public API - the type of the event args: Maybe we should document all the breaking changes we do here somewhere? |
Valid concern, and if possible how about we avoid the breaking if possible first? When we did IgbComboChangeEventArgs : IgbComboChangeEventArgs<object>so the old classes
|
Description
Changeevent when usingT="int"throwing exception silently.Valueargs with specified generic type.IgbComboChangeEventArgsandIgbComboChangeEventArgsDetail.int/double/string.Motivation / Context
The above items are quite critical to the normal Combo functioning in Blazor when using different value types and are some needed quality improvements.
Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Combo, Possibly Calendar
How Has This Been Tested?
Test Configuration:
Screenshots / Recordings
Checklist:
README.MDCHANGELOG.MDupdates for newly added functionalityCloses #364