Skip to content

Commit cae60db

Browse files
committed
fix(cloud): refresh ports when group expands
1 parent c864af5 commit cae60db

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Sources/Cloud/CloudTreeNode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ final class CloudTreeNode: NSObject {
9696
case .placeholder: return "placeholder"
9797
}
9898
}
99-
99+
/// Port discovery is demand-driven when the user opens the Ports group.
100+
var refreshesOnExpansion: Bool { if case .portsGroup = kind { true } else { false } }
100101
/// Copies the values of an equal-structure rebuild into this node (NSOutlineView keeps
101102
/// the object it was handed; updating it in place keeps rows, expansion and the
102103
/// selection untouched). Children are adopted pairwise — callers guarantee the
@@ -108,7 +109,6 @@ final class CloudTreeNode: NSObject {
108109
child.adopt(from: replacement)
109110
}
110111
}
111-
112112
var machine: SurfaceMachineID {
113113
switch kind {
114114
case .machine(let snapshot, _): return .cloud(snapshot.id)

Sources/Cloud/CloudTreeOutlineView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ struct CloudTreeOutlineView: NSViewRepresentable {
369369
func outlineView(_ outlineView: NSOutlineView, shouldSelectItem item: Any) -> Bool {
370370
true
371371
}
372-
373372
func outlineViewSelectionDidChange(_ notification: Notification) {
374373
guard !isUpdatingProgrammatically, let outlineView else { return }
375374
selectedNodeID = outlineView.selectedRow >= 0
@@ -380,6 +379,7 @@ struct CloudTreeOutlineView: NSViewRepresentable {
380379
func outlineViewItemDidExpand(_ notification: Notification) {
381380
guard !isUpdatingProgrammatically, let node = notification.userInfo?["NSObject"] as? CloudTreeNode else { return }
382381
expansionStore.setExpanded(true, node: node)
382+
if node.refreshesOnExpansion { nodeActions.refresh() }
383383
}
384384

385385
func outlineViewItemDidCollapse(_ notification: Notification) {

0 commit comments

Comments
 (0)