refactor(state): drop kon_tasks localStorage cache — Tauri-first, UI-on-success

This commit is contained in:
2026-04-19 16:14:49 +01:00
parent 6113e6d784
commit db5c739f22
2 changed files with 109 additions and 74 deletions

View File

@@ -67,7 +67,7 @@ pub struct CreateTaskRequest {
pub async fn create_task_cmd(
state: tauri::State<'_, AppState>,
request: CreateTaskRequest,
) -> Result<(), String> {
) -> Result<TaskDto, String> {
db_insert_task(
&state.db,
&request.id,
@@ -76,7 +76,15 @@ pub async fn create_task_cmd(
request.source_transcript_id.as_deref(),
)
.await
.map_err(|e| e.to_string())
.map_err(|e| e.to_string())?;
// Fetch the freshly-inserted row so the frontend can stop doing
// client-side object construction. Mirrors list_tasks_cmd's shape.
db_get_task(&state.db, &request.id)
.await
.map_err(|e| e.to_string())?
.map(TaskDto::from)
.ok_or_else(|| format!("Task {} not found after insert", request.id))
}
#[tauri::command]