diff --git a/packages/web-ui/src/storage/backends/indexeddb-storage-backend.ts b/packages/web-ui/src/storage/backends/indexeddb-storage-backend.ts index 86fc144f..e6b9f040 100644 --- a/packages/web-ui/src/storage/backends/indexeddb-storage-backend.ts +++ b/packages/web-ui/src/storage/backends/indexeddb-storage-backend.ts @@ -64,7 +64,13 @@ export class IndexedDBStorageBackend implements StorageBackend { const db = await this.getDB(); const tx = db.transaction(storeName, "readwrite"); const store = tx.objectStore(storeName); - await this.promisifyRequest(store.put(value, key)); + // If store has keyPath, only pass value (in-line key) + // Otherwise pass both value and key (out-of-line key) + if (store.keyPath) { + await this.promisifyRequest(store.put(value)); + } else { + await this.promisifyRequest(store.put(value, key)); + } } async delete(storeName: string, key: string): Promise { @@ -121,7 +127,13 @@ export class IndexedDBStorageBackend implements StorageBackend { }, set: async (storeName: string, key: string, value: T) => { const store = idbTx.objectStore(storeName); - await this.promisifyRequest(store.put(value, key)); + // If store has keyPath, only pass value (in-line key) + // Otherwise pass both value and key (out-of-line key) + if (store.keyPath) { + await this.promisifyRequest(store.put(value)); + } else { + await this.promisifyRequest(store.put(value, key)); + } }, delete: async (storeName: string, key: string) => { const store = idbTx.objectStore(storeName);