From ad5a800d1b93bc07ef548cfa67f2212b404f7650 Mon Sep 17 00:00:00 2001 From: akanyan Date: Fri, 28 Mar 2025 23:34:04 +0000 Subject: [PATCH] fix: start blocking the gui --- rust/src/cmd.rs | 9 +++++++-- src/components/App.vue | 26 +++++--------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/rust/src/cmd.rs b/rust/src/cmd.rs index df75594..4ff5691 100644 --- a/rust/src/cmd.rs +++ b/rust/src/cmd.rs @@ -63,8 +63,13 @@ pub async fn startline(app: AppHandle, refresh: bool) -> Result<(), String> { log::debug!("{}", hash); p.line_up(hash, refresh, app.clone()).await .map_err(|e| format!("Lineup failed:\n{}", e))?; - p.start(app.clone()).await - .map_err(|e| format!("Startup failed:\n{}", e))?; + let app_clone = app.clone(); + let p_clone = p.clone(); + tauri::async_runtime::spawn(async move { + if let Err(e) = p_clone.start(app_clone).await { + log::error!("Startup failed:\n{}", e); + } + }); Ok(()) } else { diff --git a/src/components/App.vue b/src/components/App.vue index 1bc49e2..6f63498 100644 --- a/src/components/App.vue +++ b/src/components/App.vue @@ -16,7 +16,6 @@ import StartButton from './StartButton.vue'; import { invoke } from '../invoke'; import { useGeneralStore, usePkgStore, usePrfStore } from '../stores'; import { Dirs } from '../types'; -import { listen } from '@tauri-apps/api/event'; const pkg = usePkgStore(); const prf = usePrfStore(); @@ -28,7 +27,6 @@ const currentTab: Ref = ref(3); const pkgSearchTerm = ref(''); const isProfileDisabled = computed(() => prf.current === null); -const isRunning = ref(false); onMounted(async () => { invoke('list_directories').then((d) => { @@ -56,16 +54,6 @@ onMounted(async () => { }); }); -listen('launch-start', () => { - isRunning.value = true; - currentTab.value = 5; -}); - -listen('launch-end', () => { - isRunning.value = false; - currentTab.value = 0; -}); -