This commit is contained in:
2026-09-27 08:03:56 +07:00
parent 3a70bb7228
commit 4d2d058396
6 changed files with 59 additions and 134 deletions
+2 -9
View File
@@ -93,8 +93,8 @@ impl ProfileStore {
pub(crate) fn new(cx: &mut Context<Self>) -> Self {
let backend = Backend::global(cx);
let subscription = cx.subscribe(&backend, |this, _backend, event, cx| match event {
BackendEvent::NostrUpdate(updates) => {
let subscription = cx.subscribe(&backend, |this, _backend, event, cx| {
if let BackendEvent::NostrUpdate(updates) = event {
for update in updates
.iter()
.filter(|update| update.kind == Kind::Metadata)
@@ -102,13 +102,6 @@ impl ProfileStore {
this.apply_author(update.author, cx);
}
}
BackendEvent::Published(event) if event.kind == Kind::Metadata => {
let metadata = Metadata::from_json(&event.content).unwrap_or_default();
this.profiles
.insert(event.pubkey, Profile::new(event.pubkey, metadata));
cx.notify();
}
_ => {}
});
// Fetch requests are queued on a channel, batched into one sync per debounce window.