automerge / automerge-classic

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
http://automerge.org/
MIT License
14.77k stars 467 forks source link

indexOf fails in a proxy with undefined index #508

Closed fo-fo closed 1 year ago

fo-fo commented 1 year ago

This code causes an exception to be thrown:

Automerge.change(doc1, doc =>
{
  // Uncaught TypeError: o is undefined
  doc.someList.indexOf(undefined);
})

In a normal (non-proxified) array the result is -1, as expected:

// -1
[1, 2, 3].indexOf(undefined)
ept commented 1 year ago

Thanks! I have fixed this in ca51f43d7578d56bab302bdcb805f44af094e7b7