Edit changes execute out of order


#1

If I make an edit request POST /api/v1/doc/edit with multiple changes, I would expect the changes to execute in the given order.

For example, if I post these changes:

{
  file_id: FILE_ID,
  token: DYNALIST_TOKEN,
  changes: [
    {
      action: 'insert',
      parent_id: ITEM_ID,
      content: 'task 3',
    },
    {
      action: 'insert',
      parent_id: ITEM_ID,
      content: 'task 2',
    },
    {
      action: 'insert',
      parent_id: ITEM_ID,
      content: 'task 1',
    },
  ]
}

I would expect it to insert task 3, then task 2, then task 1. Instead, the inserts seem to complete in random order.


#2

For me, items are inserted in reverse order. Which is counterintuitive, but at least consistent.


#3

@Shida Similar problem if a single request contains multiple indices.
E.g. a request to add n items with indices 0…n-1 does not result in the correct order.


#4

Oh huh. That’s probably something we missed. I’ll look into it as soon as I can!