Fixes for Edge

This commit is contained in:
toasted-nutbread 2019-11-09 20:49:44 -05:00
parent 4ac4128388
commit 3e864c44c3
2 changed files with 6 additions and 4 deletions

View File

@ -266,15 +266,17 @@ class Database {
]);
}
const totalPromise = getTotal ? Database.getCounts(targets, null) : null;
// Query is required for Edge, otherwise index.count throws an exception.
const query1 = IDBKeyRange.lowerBound('', false);
const totalPromise = getTotal ? Database.getCounts(targets, query1) : null;
const counts = [];
const countPromises = [];
for (let i = 0; i < dictionaryNames.length; ++i) {
counts.push(null);
const index = i;
const only = IDBKeyRange.only(dictionaryNames[i]);
const countPromise = Database.getCounts(targets, only).then(v => counts[index] = v);
const query2 = IDBKeyRange.only(dictionaryNames[i]);
const countPromise = Database.getCounts(targets, query2).then(v => counts[index] = v);
countPromises.push(countPromise);
}
await Promise.all(countPromises);

View File

@ -53,7 +53,7 @@ class SettingsDictionaryListUI {
const titles = this.dictionaryEntries.map(e => e.dictionaryInfo.title);
const removeKeys = Object.keys(this.optionsDictionaries).filter(key => titles.indexOf(key) < 0);
if (removeKeys.length >= 0) {
for (const key of removeKeys) {
for (const key of toIterable(removeKeys)) {
delete this.optionsDictionaries[key];
}
changed = true;