diff --git a/.changeset/itchy-onions-confess.md b/.changeset/itchy-onions-confess.md new file mode 100644 index 000000000..119cd5e84 --- /dev/null +++ b/.changeset/itchy-onions-confess.md @@ -0,0 +1,5 @@ +--- +"nostrudel": patch +--- + +Fix user app settings being cached diff --git a/src/services/app-settings.ts b/src/services/app-settings.ts index f3b143e74..0c59f62f7 100644 --- a/src/services/app-settings.ts +++ b/src/services/app-settings.ts @@ -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); } } diff --git a/src/services/user-app-settings.ts b/src/services/user-app-settings.ts index bd932acf1..f179bae01 100644 --- a/src/services/user-app-settings.ts +++ b/src/services/user-app-settings.ts @@ -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>(