init project in add_project handler

This commit is contained in:
Nikita Galaiko 2023-03-14 09:45:30 +01:00
parent cb93ce5ce1
commit 9958730c2f
No known key found for this signature in database
GPG Key ID: EBAB54E845BA519D

View File

@ -286,6 +286,12 @@ fn add_project(handle: tauri::AppHandle, path: &str) -> Result<projects::Project
let project = projects::Project::from_path(path.to_string())?;
app_state.projects_storage.add_project(&project)?;
repositories::Repository::open(
&app_state.projects_storage,
&app_state.users_storage,
&project.id,
)?;
let (tx, rx): (mpsc::Sender<events::Event>, mpsc::Receiver<events::Event>) = mpsc::channel();
app_state.watchers.lock().unwrap().watch(tx, &project)?;
watch_events(handle, rx);