web: fixed profile fetching to be seq

This commit is contained in:
Thomas Mathews 2022-12-21 18:00:26 -08:00
parent 9f81e93738
commit 4d9151b8ae
7 changed files with 118 additions and 207 deletions

View file

@ -28,10 +28,6 @@ async function contacts_save(contacts) {
const db = ev.target.result;
let tx = db.transaction("friends", "readwrite");
let store = tx.objectStore("friends");
contacts.friends.forEach((pubkey) => {
//log_debug("storing", pubkey);
store.put({pubkey});
});
tx.oncomplete = (ev) => {
db.close();
resolve();
@ -43,6 +39,13 @@ async function contacts_save(contacts) {
window.alert("An error occured saving contacts. Check console.");
reject(ev);
};
store.clear().onsuccess = () => {
contacts.friends.forEach((pubkey) => {
//log_debug("storing", pubkey);
store.put({pubkey});
});
};
}
return dbcall(_contacts_save);
}