Skip to content

Commit 58fae97

Browse files
fix: Prevent false offline notifications for normal sync states
The sync service's Idle and Running states are normal operational states that should not trigger offline error popups. Only Error, Terminated, and Offline states indicate actual connection problems. This fixes the issue where users would see 'Cannot reach Matrix homeserver' error incorrectly after registration when the sync service is actually working. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6509e20 commit 58fae97

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

src/home/rooms_list_header.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,21 @@ impl Widget for RoomsListHeader {
104104
if &self.sync_state == new_state {
105105
continue;
106106
}
107-
log!("Setting the RoomsListHeader to offline.");
108-
self.view.view(id!(loading_spinner)).set_visible(cx, false);
109-
self.view.view(id!(synced_icon)).set_visible(cx, false);
110-
self.view.view(id!(offline_icon)).set_visible(cx, true);
111-
enqueue_popup_notification(PopupItem {
112-
message: "Cannot reach the Matrix homeserver. Please check your connection.".into(),
113-
auto_dismissal_duration: None,
114-
kind: PopupKind::Error,
115-
});
107+
108+
// Only show offline notification for actual connection errors
109+
// States like Idle and Running are normal and shouldn't trigger error popups
110+
if matches!(new_state, State::Error | State::Terminated | State::Offline) {
111+
log!("Setting the RoomsListHeader to offline.");
112+
self.view.view(id!(loading_spinner)).set_visible(cx, false);
113+
self.view.view(id!(synced_icon)).set_visible(cx, false);
114+
self.view.view(id!(offline_icon)).set_visible(cx, true);
115+
enqueue_popup_notification(PopupItem {
116+
message: "Cannot reach the Matrix homeserver. Please check your connection.".into(),
117+
auto_dismissal_duration: None,
118+
kind: PopupKind::Error,
119+
});
120+
}
121+
// For all other states (Idle, Running, etc.), just update without error notification
116122
self.sync_state = new_state.clone();
117123
self.redraw(cx);
118124
}

0 commit comments

Comments
 (0)