From 98539718c1c5b8d1c2e0502a1cff28fe2c0d5798 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 2 Nov 2021 20:33:16 +0100 Subject: [PATCH] Fix disconnecting from a repository not removing the selected repository Signed-off-by: trivernis --- mediarepo-api/src/tauri_plugin/commands/repo.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mediarepo-api/src/tauri_plugin/commands/repo.rs b/mediarepo-api/src/tauri_plugin/commands/repo.rs index 2977030..fa7854a 100644 --- a/mediarepo-api/src/tauri_plugin/commands/repo.rs +++ b/mediarepo-api/src/tauri_plugin/commands/repo.rs @@ -61,8 +61,13 @@ pub async fn add_repository( } #[tauri::command] -pub async fn disconnect_repository(api_state: ApiAccess<'_>) -> PluginResult<()> { +pub async fn disconnect_repository( + app_state: AppAccess<'_>, + api_state: ApiAccess<'_>, +) -> PluginResult<()> { api_state.disconnect().await; + let mut active_repo = app_state.active_repo.write().await; + mem::take(&mut *active_repo); Ok(()) }