yjs / y-indexeddb

IndexedDB database adapter for Yjs
https://docs.yjs.dev/ecosystem/database-provider/y-indexeddb
Other
196 stars 30 forks source link

Failed to execute 'put' on 'IDBObjectStore': The parameter is not a valid key #9

Closed KrishnaPG closed 4 years ago

KrishnaPG commented 4 years ago

Describe the bug IndexeddbPersistence.set() method has problems.

Checkout this line of code https://github.com/yjs/y-indexeddb/blob/2d21bdfc8ba7e862148f574cb1ce79c25c025e1b/src/y-indexeddb.js#L152

and then check this definition of put method from lib0:

export const put = (store, item, key) =>
  rtop(store.put(item, key))

https://github.com/dmonad/lib0/blob/8a89d8d369c9dccd1187a75c04232e2a1ce39b7b/indexeddb.js#L126

The lib0 is expecting item followed by key as parameters, while the set call in this package is sending key first and then value next, which is leading to the error:

image

Failed to execute 'put' on 'IDBObjectStore': The parameter is not a valid key
dmonad commented 4 years ago

Thanks for noticing. Fixed it