From 025c80f6e20a9f50f7a17544e37ea250423f6712 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 9 Jan 2025 17:03:08 +0100 Subject: [PATCH] fix(web): ghetto way to decrease notified counter --- web/src/activities/item.rs | 2 ++ web/src/app.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/web/src/activities/item.rs b/web/src/activities/item.rs index 456794a..81e5461 100644 --- a/web/src/activities/item.rs +++ b/web/src/activities/item.rs @@ -115,6 +115,7 @@ pub fn Item( #[component] fn AckBtn(id: String, tx: WriteSignal) -> impl IntoView { let auth = use_context::().expect("missing auth context"); + let (notifications, set_notifications) = use_context::<(ReadSignal, WriteSignal)>().expect("missing notifications context"); view! { ) -> impl IntoView { tracing::error!("failed marking notification as seen: {e}"); } else { tx.set(false); + set_notifications.set(notifications.get() - 1); } }); } diff --git a/web/src/app.rs b/web/src/app.rs index 4453aae..5dfed91 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -137,6 +137,7 @@ pub fn App() -> impl IntoView { }); fetch_notifications(); set_interval(fetch_notifications, std::time::Duration::from_secs(60)); + provide_context((notifications, set_notifications)); view! {