Skip to content

Commit 6bca761

Browse files
committed
fix: new post alerts
1 parent d858164 commit 6bca761

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

crates/rostra-web-ui/src/routes/timeline.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,11 @@ impl UiState {
190190
continue;
191191
}
192192
count += 1;
193-
let _ = ws
194-
.send(
195-
html! {
196-
(self.render_new_posts_alert(true, count))
197-
}
198-
.into_string()
199-
.into(),
200-
)
201-
.await;
193+
let alert_html = html! {
194+
(self.render_new_posts_alert(true, count))
195+
}
196+
.into_string();
197+
let _ = ws.send(alert_html.into()).await;
202198
tokio::time::sleep(Duration::from_millis(100)).await;
203199
}
204200
Ok(())
@@ -432,11 +428,11 @@ impl UiState {
432428

433429
pub fn render_new_posts_alert(&self, visible: bool, count: u64) -> Markup {
434430
html! {
435-
// TODO: Update new posts alert - need Alpine.js event or different approach
436-
// (alpine-ajax doesn't support x-swap-oob)
437-
a ."o-mainBar__newPostsAlert"
431+
a id="new-posts-alert"
432+
."o-mainBar__newPostsAlert"
438433
."-hidden"[!visible]
439-
href="/home"
434+
href="/home"
435+
x-swap-oob="outerHTML:#new-posts-alert"
440436
{
441437
(if count == 0 {
442438
"No new posts available".to_string()

0 commit comments

Comments
 (0)