Skip to content

Commit

Permalink
Specify readonly as the default indexeddb transaction mode (#6122)
Browse files Browse the repository at this point in the history
* Specify readonly as the default indexeddb transaction mode

While the mode parameter is optional, the wrapper method will pass `undefined` into the native method if it is not passed into the wrapper. IE11 interprets this as a mode instead of ignoring it and throws an InvalidAccessError.

Specifying `readonly` as the default (which is the default if the parameter is omitted) prevents IE11 from crashing during initialization.

* Bump patch version for @firebase/util
  • Loading branch information
tmrudick authored Apr 11, 2022
1 parent e5284a1 commit e9e5f6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hungry-owls-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/util': patch
---

Default indexeddb transaction mode to readonly for IE11 compatibility
2 changes: 1 addition & 1 deletion packages/util/src/indexeddb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class DBWrapper {
}
transaction(
storeNames: string[] | string,
mode?: IDBTransactionMode
mode: IDBTransactionMode = 'readonly'
): TransactionWrapper {
return new TransactionWrapper(
this._db.transaction.call(this._db, storeNames, mode)
Expand Down

0 comments on commit e9e5f6b

Please sign in to comment.