You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The removeItems function exposed by the array HOC does not work well with indexes above 10.
For instance, given a custom list renderer that holds 12 items, props.removeItems('', [11, 2])() won't give the expected result: only the item at index 2 will be removed.
The issue is with the usage of sort on an array of number in the implementation: [1, 2, 10].sort() === [1, 10, 2].
Expected behavior
The removeItems function exposed by the array HOC should work well with indexes above 10.
In this example, item at index 11 should have been removed.
Steps to reproduce the issue
Here is a test that reproduces the issue:
test('mapDispatchToArrayControlProps should remove items from array with more than 10 items',(t)=>{constdata=['0','1','2','3','4','5','6','7','8','9','10','11'];constschema: JsonSchema={type: 'array',items: {type: 'string',},};constuischema: ControlElement={type: 'Control',scope: '#',};constinitCore: JsonFormsCore={
uischema,
schema,
data,errors: []asErrorObject[],};const[getCore,dispatch]=mockDispatch(initCore);dispatch(init(data,schema,uischema));constprops=mapDispatchToArrayControlProps(dispatch);props.removeItems('',[11,2])();t.is(getCore().data.length,10);// fails, actual value is 11});
Screenshots
No response
In which browser are you experiencing the issue?
any
Which Version of JSON Forms are you using?
master
Framework
core
RendererSet
No response
Additional context
Custom renderer
The text was updated successfully, but these errors were encountered:
Describe the bug
The
removeItems
function exposed by the array HOC does not work well with indexes above 10.For instance, given a custom list renderer that holds 12 items,
props.removeItems('', [11, 2])()
won't give the expected result: only the item at index 2 will be removed.The issue is with the usage of
sort
on an array of number in the implementation:[1, 2, 10].sort() === [1, 10, 2]
.Expected behavior
The
removeItems
function exposed by the array HOC should work well with indexes above 10.In this example, item at index 11 should have been removed.
Steps to reproduce the issue
Here is a test that reproduces the issue:
Screenshots
No response
In which browser are you experiencing the issue?
any
Which Version of JSON Forms are you using?
master
Framework
core
RendererSet
No response
Additional context
Custom renderer
The text was updated successfully, but these errors were encountered: