Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ fun LayoutInspectorDashboard(
}
}

// Poll socket existence so the UI reacts when the daemon starts or stops.
// Only active when disconnected/connecting — connected state doesn't need this.
var socketExists by remember { mutableStateOf(ObservationStreamClient.socketExists()) }
val isDisconnectedOrConnecting = state.connectionStatus == ConnectionStatus.Disconnected ||
state.connectionStatus == ConnectionStatus.Connecting
LaunchedEffect(isDisconnectedOrConnecting) {
if (isDisconnectedOrConnecting) {
while (true) {
socketExists = ObservationStreamClient.socketExists()
kotlinx.coroutines.delay(2000)
}
} else {
socketExists = true
}
}

// Initial fetch as fallback (in case stream hasn't pushed yet)
LaunchedEffect(dataSourceMode, clientProvider) {
kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
Expand Down Expand Up @@ -189,7 +205,7 @@ fun LayoutInspectorDashboard(
showTapTargetIssues = state.showTapTargetIssues,
onToggleTapTargetIssues = { state.toggleTapTargetIssues() },
connectionStatus = state.connectionStatus,
socketExists = ObservationStreamClient.socketExists(),
socketExists = socketExists,
onRestartDaemon = onRestartDaemon,
modifier = Modifier.fillMaxSize(),
refitTrigger = refitTrigger, // Trigger refit when panels toggle
Expand Down