Closed dnhyde closed 5 years ago
https://static-misc.glitch.me/idb-basic/ this works for me in both Firefox Nightly and developer edition. Is it failing for you?
If it's failing, I'm 99% sure this is a Firefox bug. The library doesn't do anything special here.
Yes it works thanks I will switch to async await for now I am using promises
Now I am not able to reproduce the first error and I am sure there is no diff in my code... The second error is due to an add
instead of a put
silly me!
The code that produced the error is the following, let me know if you notice anything weird... Thanks :)
const initDB = function() {
//check for support
if (!("indexedDB" in window)) {
console.log("This browser doesn't support IndexedDB");
return;
}
let dbPromise = idb.openDb("my-indexed-db", 1, function(upgradeDb) {
if (!upgradeDb.objectStoreNames.contains("users")) {
let users = upgradeDb.createObjectStore("users", { keyPath: "idFb" });
users.createIndex("email", "email", { unique: true });
}
});
dbPromise
.then(db => {
let tx = db.transaction("users", "readwrite");
let users = tx.objectStore("users");
//USERS is fetched from backend
USERS.map(u => users.put(u));
return tx.complete;
})
.then(function() {
console.log("added users to the users objectStore of indexedDB!");
});
};
initDB();
I will let you know if the first error comes up again sorry
I am using Firefox Developer Edition (66.0b10) and idb v3.0.2.
When opening the db with
idb.openDb("my-indexed-db", 1, function(upgradeDb)
I have the following error:
This error seems to be similar to what reported for firebase auth .
The exact same code works just fine in Firefox 62.0.3 (statndard edition). Still the same code, after updating to Firefox 65.0.1 (standard edition), produces the following error:
Maybe as soon as Firefox hits v66 we shall see the first error pop out in the standard edition as well... (New features are stabilized for 12 weeks before appearing in the released version of Firefox. As MDN says here).
Hope this helps!