Seemingly fix a bug in utils.ts

This commit is contained in:
Danila Fedorin 2021-08-09 19:13:32 -07:00
parent 0c80f78e9b
commit a0017cb720

View File

@ -201,12 +201,12 @@ export async function findStoreValue<T>(db: IDBDatabase, storeName: string, toCu
const store = tx.objectStore(storeName); const store = tx.objectStore(storeName);
const cursor = await reqAsPromise(toCursor(store)); const cursor = await reqAsPromise(toCursor(store));
let match; let match;
// @ts-ignore
const matched = await iterateCursor<T>(cursor, (value) => { const matched = await iterateCursor<T>(cursor, (value) => {
if (matchesValue(value)) { if (matchesValue(value)) {
match = value; match = value;
return true; return { done: true };
} }
return { done: false };
}); });
if (!matched) { if (!matched) {
throw new StorageError("Value not found"); throw new StorageError("Value not found");