don't start transaction if there is no work

This commit is contained in:
Florian Dold 2016-05-25 21:30:48 +02:00
parent 34b65e2ef7
commit cb531beaef

View File

@ -357,6 +357,10 @@ class QueryRoot {
return this.kickoffPromise;
}
this.kickoffPromise = new Promise((resolve, reject) => {
if (this.work.length == 0) {
resolve();
return;
}
const mode = this.hasWrite ? "readwrite" : "readonly";
const tx = this.db.transaction(Array.from(this.stores), mode);
tx.oncomplete = () => {