jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.31k stars 356 forks source link

Renaming store in transaction throws error #147

Closed mustafa0x closed 4 years ago

mustafa0x commented 4 years ago
const store = transaction.objectStore('old-name');
// TypeError: Illegal invocation
store.name = 'new-name';
// Works (no error; renames the objectStore)
unwrap(store).name = 'new-name';
jakearchibald commented 4 years ago

Demo: https://static-misc-2.glitch.me/idb/store-rename.html

https://github.com/jakearchibald/idb/blob/master/lib/wrap-idb-value.ts#L120 - I need to add a set trap.

jakearchibald commented 4 years ago

Thanks for reporting this!

The only assignable things are name (on both stores and indexes), and event handlers. I guess I should just let all assignment through and let the underlying object deal with it.