Do I Need To Refresh A Page To See If The Indexed DB Was Reset?
I started working with Indexed DB for HTML 5 but I am obtaining some strange results. The first one is that I try to clear my database but I only see that it was reset if I refresh
Solution 1:
onsuccess
can fire before the results are actually updated in the database (see this answer to a question I asked here. So if update_patients_stored
is reading from the database, it might still see the old data. If you use a transaction's oncomplete
, then you won't have that problem.
If that is indeed causing your issue, then this will fix it:
var tx = localDatabase.db.transaction("patients", "readwrite");
tx.objectStore("patients").clear();
tx.oncomplete = function(event)
{
alert("Patients DB cleared");
update_patients_stored();
};
Post a Comment for "Do I Need To Refresh A Page To See If The Indexed DB Was Reset?"