I know that this has been discussed ‘Update values in y-array (list structures)’ and ‘Set method’, however the discussion has been closed 3 years ago with no updates. I was wondering if there is a smarter/more efficient way of changing value of an element of YArray than this:
const ydoc = new Y.Doc();
ydoc.getArray('array').push(0); // [0]
// set the value of index 0 to 1
ydoc.transact(() => {
ydoc.getArray('array').delete(0); // []
ydoc.getArray('array').insert(0, [1]); // [1]
});