ssh: Do not look up dev servers when rendering the default mode (#19295)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run

This should help with the bug where there's a mismatch between
connection count and the list showing empty state.

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-10-16 18:53:05 +02:00 committed by GitHub
parent f8f3f369f6
commit 7a5003bea2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,7 +16,6 @@ use gpui::canvas;
use gpui::pulsating_between;
use gpui::AsyncWindowContext;
use gpui::ClipboardItem;
use gpui::Subscription;
use gpui::Task;
use gpui::WeakView;
use gpui::{
@ -60,9 +59,7 @@ pub struct DevServerProjects {
mode: Mode,
focus_handle: FocusHandle,
scroll_handle: ScrollHandle,
dev_server_store: Model<dev_server_projects::Store>,
workspace: WeakView<Workspace>,
_dev_server_subscription: Subscription,
selectable_items: SelectableItemList,
}
@ -333,11 +330,6 @@ impl DevServerProjects {
pub fn new(cx: &mut ViewContext<Self>, workspace: WeakView<Workspace>) -> Self {
let focus_handle = cx.focus_handle();
let dev_server_store = dev_server_projects::Store::global(cx);
let subscription = cx.observe(&dev_server_store, |_, _, cx| {
cx.notify();
});
let mut base_style = cx.text_style();
base_style.refine(&gpui::TextStyleRefinement {
@ -349,9 +341,7 @@ impl DevServerProjects {
mode: Mode::default_mode(),
focus_handle,
scroll_handle: ScrollHandle::new(),
dev_server_store,
workspace,
_dev_server_subscription: subscription,
selectable_items: Default::default(),
}
}
@ -1113,7 +1103,6 @@ impl DevServerProjects {
cx: &mut ViewContext<Self>,
) -> impl IntoElement {
let scroll_state = scroll_state.parent_view(cx.view());
let dev_servers = self.dev_server_store.read(cx).dev_servers();
let ssh_connections = SshSettings::get_global(cx)
.ssh_connections()
.collect::<Vec<_>>();
@ -1171,7 +1160,7 @@ impl DevServerProjects {
)
.into_any_element();
let server_count = format!("Servers: {}", ssh_connections.len() + dev_servers.len());
let server_count = format!("Servers: {}", ssh_connections.len());
Modal::new("remote-projects", Some(self.scroll_handle.clone()))
.header(