IgniteUI / igniteui-react

High-Performance Data Grid and High-Volume Data Charts
Other
6 stars 1 forks source link

In combo change event error is thrown #70

Closed wnvko closed 5 months ago

wnvko commented 6 months ago

Description

I am trying to handle change event of the combo component.

Steps to reproduce

Use code like this:

const [category, setCategory] = useState<CategoriesType | undefined>();
...
<IgrCombo value={[category]} change={(_s, e) => setCategory(e.detail.newValue[0])} data={northwindCategories} displayKey="description" singleSelect="true"></IgrCombo>
<p>Category name is {category?.name}</p>

Result

Error is thrown in the console:

Uncaught TypeError: Cannot read properties of null (reading 'newValue')
    at WCNativeHelper2.n (WCNativeHelper_combined.js:44:17)
    at ComboChangeEventArgsDetail2.get (ComboChangeEventArgsDetail.js:24:31)
    at IgrComboChangeEventArgsDetail2.get (igr-combo-change-event-args-detail.js:39:27)
    at IgrCombo2.change [as _change] (other-inputs.tsx:73:84)
    at Combo2._change_wrapped [as change] (igr-combo.js:655:27)
    at Combo.js:324:60
    at IgcComboComponent2.nativeHandler_ (WCNativeHelper_combined.js:218:17)
    at IgcComboComponent2.emitEvent (event-emitter.ts:89:19)
    at SelectionController.handleChange (selection.ts:31:22)
    at SelectionController.select (selection.ts:113:13)

Both detail.Items and detail.NewValue are throwing. Note the behavior is the same with or without valueKey set as wella as for singleSelect set to true and false.

Expected result

change event should emit correct and usable values.

MayaKirova commented 5 months ago

Already fixed: https://infragistics.visualstudio.com/NetAdvantage/_git/dev-tools/pullrequest/12752