mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 05:13:01 +00:00
Implement profile-scoped caching and signer invalidation logic
- Updated `profileCache.js` to support clearing runtime memory on signer change. - Updated `NostrClient` to trigger `clearSignerRuntime` on `setActiveSigner`. - Updated list services (`subscriptions`, `userBlocks`, `hashtagPreferences`, `watchHistory`) to listen for `runtimeCleared` and reload data. - Updated `NostrClient` sync metadata methods to default to the active profile pubkey. - Added `partition-updated` event emission to `profileCache`.
This commit is contained in:
1 parent
1f8dfab811
commit
3deb8d08f0
6 files changed
+50
-3
No files matched your search
@@ -168,6 +168,7 @@ class ProfileCache {
|
||||
// But if services manage runtime state, `profileCache` acts as the persistence layer.
|
||||
|
||||
this.emit("update", { pubkey, section, data });
|
||||
this.emit("partition-updated", { pubkey, key: section });
|
||||
}
|
||||
|
||||
// Runtime memory cache methods (for decrypted data, if services want to use it)
|
||||
@@ -197,6 +198,15 @@ class ProfileCache {
|
||||
}
|
||||
}
|
||||
|
||||
clearSignerRuntime(pubkey) {
|
||||
const normalized = this.normalizeHexPubkey(pubkey);
|
||||
if (!normalized) {
|
||||
return;
|
||||
}
|
||||
this.clearMemoryCache(normalized);
|
||||
this.emit("runtimeCleared", { pubkey: normalized });
|
||||
}
|
||||
|
||||
subscribe(callback) {
|
||||
this.listeners.add(callback);
|
||||
return () => this.listeners.delete(callback);
|
||||
|
||||
Reference in new issue
Block a user