fix setting loading

This commit is contained in:
hzrd149
2023-06-27 16:23:11 +00:00
parent 39ef920289
commit 7f162ac28a
3 changed files with 8 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
---
"nostrudel": patch
---
Fix user app settings being cached

View File

@@ -35,7 +35,7 @@ export async function loadSettings() {
appSettings.next(account.localSettings);
}
} else {
const subject = userAppSettings.requestAppSettings(account.pubkey, clientRelaysService.getReadUrls());
const subject = userAppSettings.requestAppSettings(account.pubkey, clientRelaysService.getReadUrls(), true);
appSettings.connect(subject);
}
}

View File

@@ -63,15 +63,8 @@ class UserAppSettings {
requester: CachedPubkeyEventRequester;
constructor() {
this.requester = new CachedPubkeyEventRequester(30078, "user-app-data", DTAG);
this.requester.readCache = this.readCache;
this.requester.writeCache = this.writeCache;
}
readCache(pubkey: string) {
return db.get("settings", pubkey);
}
writeCache(pubkey: string, event: NostrEvent) {
return db.put("settings", event);
this.requester.readCache = (pubkey) => db.get("settings", pubkey);
this.requester.writeCache = (pubkey, event) => db.put("settings", event);
}
private parsedSubjects = new SuperMap<string, PersistentSubject<AppSettings>>(