yjs / y-indexeddb

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

Optimization: Remove getLastKey #30

Closed raineorshine closed 1 year ago

raineorshine commented 1 year ago

The call to getLastKey is not needed, as addAutoKey returns the last key. We just need to save it after each update.

This results in one fewer IDBTransaction by fetchUpdates.

Tests all pass and the change has been used in a live application, though care should be taken as test coverage of _dbref is limited.