From f4b7d79cbd36234d989784f0a090e1b23c808814 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 4 Jan 2024 19:55:13 +0000 Subject: [PATCH] Fetch the two main feeds on startup. Mostly, this fixes missing message beeps. But it also means the UI won't pause annoyingly the first time I go to one of those feeds. --- src/tui.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tui.rs b/src/tui.rs index ef3db94..99829a5 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -17,7 +17,9 @@ use std::fs::File; use unicode_width::UnicodeWidthStr; use super::activity_stack::*; -use super::client::{Client, ClientError, FeedId, StreamId, StreamUpdate}; +use super::client::{ + Client, ClientError, FeedId, FeedExtend, StreamId, StreamUpdate, +}; use super::coloured_string::{ColouredString, ColouredStringSlice}; use super::config::ConfigLocation; use super::menu::*; @@ -304,6 +306,15 @@ impl Tui { }))?; } + // Now fetch the two basic feeds - home and mentions. Most + // importantly, getting the mentions feed started means that + // we can spot updates to it after that. + // + // We must do this _after_ starting the stream listener, so + // that we won't miss a notification due to a race condition. + self.client.fetch_feed(&FeedId::Home, FeedExtend::Initial)?; + self.client.fetch_feed(&FeedId::Mentions, FeedExtend::Initial)?; + self.main_loop() } -- 2.30.2