field-form icon indicating copy to clipboard operation
field-form copied to clipboard

Nested List not working as expected, synthetic event returned for value instead of input value

Open amitava82 opened this issue 5 years ago • 2 comments

Nested List Item seems to return React synthetic event as value instead of input value. For example

users[]
  - 0
    - fname (correct input value)
    - lname (correct input value)
    - friends
       - fname (synthetic event as value) 

Here is a simple repo case: https://codesandbox.io/s/boring-engelbart-fn0k7?fontsize=14&hidenavigation=1&theme=dark

amitava82 avatar Mar 15 '20 05:03 amitava82

Encountered the same issue, synthetic event got returned in the intermediate level of the hierarchical value object. However, the leaf level values are correct.

:propertyOptions: Array(2) 0: {dispatchConfig: null, _targetInst: null, _dispatchListeners: null, _dispatchInstances: null, nativeEvent: null, …} 1: {dispatchConfig: null, _targetInst: null, _dispatchListeners: null, _dispatchInstances: null, nativeEvent: null, …}

Besides, there are a bunch of "Warning: This synthetic event is reused for performance reasons." shown while List item changed. The warning comes out of the setValue method of valueUtil.

More follow-up: In the defaultGetValueFromEvent method, the synthetic event object is returned when event.target is null (which happens quite often in a form list) as shown below.

if (event && event.target && valuePropName in event.target) { return event.target[valuePropName]; } return event;

Not sure the exact reason why returns a synthetic event here in the end since a synthetic event will be recycled and not guaranteed safe to reference in an async way after dispatching.

rockie avatar May 03 '20 04:05 rockie

+1 also experiencing this.

dobrynin avatar May 17 '20 21:05 dobrynin