bug: fetch zapper when indexedDb is not available

This commit is contained in:
Kieran 2023-03-06 10:10:52 +00:00
parent 5f0bd9699f
commit 840e2ff400
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
1 changed files with 13 additions and 12 deletions

View File

@ -98,8 +98,6 @@ export class UserProfileCache {
const existing = this.get(m.pubkey);
const refresh = existing && existing.created === m.created && existing.loaded < m.loaded;
if (!existing || existing.created < m.created || refresh) {
this.#cache.set(m.pubkey, m);
if (db.ready) {
// fetch zapper key
const lnurl = m.lud16 || m.lud06;
if (lnurl) {
@ -112,6 +110,9 @@ export class UserProfileCache {
}
// ignored
}
this.#cache.set(m.pubkey, m);
if (db.ready) {
await db.users.put(m);
this.#diskCache.add(m.pubkey);
}