diff --git a/src-tauri/src/commands/integrations.rs b/src-tauri/src/commands/integrations.rs index ec77f912..1c69b42f 100644 --- a/src-tauri/src/commands/integrations.rs +++ b/src-tauri/src/commands/integrations.rs @@ -325,6 +325,7 @@ pub async fn initiate_oauth( let app_data_dir = app_state.app_data_dir.clone(); let integration_webviews = app_state.integration_webviews.clone(); let mcp_connections = app_state.mcp_connections.clone(); + let pending_approvals = app_state.pending_approvals.clone(); tokio::spawn(async move { let app_state_for_callback = AppState { @@ -333,9 +334,7 @@ pub async fn initiate_oauth( app_data_dir, integration_webviews, mcp_connections, - pending_approvals: Arc::new(tokio::sync::Mutex::new( - std::collections::HashMap::new(), - )), + pending_approvals, }; while let Some(callback) = callback_rx.recv().await { tracing::info!("Received OAuth callback for state: {}", callback.state); diff --git a/src-tauri/src/commands/shell.rs b/src-tauri/src/commands/shell.rs index 0dff6a8d..46d4d318 100644 --- a/src-tauri/src/commands/shell.rs +++ b/src-tauri/src/commands/shell.rs @@ -97,11 +97,16 @@ pub fn activate_kubeconfig(id: String, state: State<'_, AppState>) -> Result<(), .map_err(|e| format!("Failed to deactivate configs: {e}"))?; // Activate the specified config - db.execute( - "UPDATE kubeconfig_files SET is_active = 1 WHERE id = ?1", - params![&id], - ) - .map_err(|e| format!("Failed to activate config: {e}"))?; + let rows_updated = db + .execute( + "UPDATE kubeconfig_files SET is_active = 1 WHERE id = ?1", + params![&id], + ) + .map_err(|e| format!("Failed to activate config: {e}"))?; + + if rows_updated == 0 { + return Err(format!("Kubeconfig with id '{}' not found", id)); + } Ok(()) }