kintone/js-sdk

The `errorIndex` of `KintoneAllRecordsError` is incorrect

tasshi-me opened this issue · 0 comments

Target Package

  • @kintone/rest-api-client 3.1.11

Environment

  • Operating System: macOS
  • Browser: N/A
  • Node.js version: 16.x

Current Behavior

The KintoneAllRecordsError pick the first element of Object.keys and create errorIndex.
This implementation does not always pick the smallest value as an errorIndex.

const firstErrorKey = Object.keys(errors)[0];

> const errors = {
...   'records[97].multiSelect.values[0].value': { messages: [ '...' ] },
...   'records[90].multiSelect.values[0].value': { messages: [ '...' ] }
... }
undefined
> Object.keys(errors)
[
  'records[97].multiSelect.values[0].value',
  'records[90].multiSelect.values[0].value'
]

Expected Behavior

The errorIndex should be the smallest index of errors