refactor(qconnect): simplify lifecycle_state JSON serialization
Drop the to_string->from_str round-trip in favor of a direct to_value call. Same fallback behavior on serializer error. cc
This commit is contained in:
1 file changed
+1
-4
@@ -417,10 +417,7 @@ async fn update_lifecycle_state_if_running(
|
||||
}
|
||||
guard.lifecycle_state = next;
|
||||
drop(guard);
|
||||
let serialized = serde_json::to_string(&next)
|
||||
.ok()
|
||||
.and_then(|s| serde_json::from_str::<Value>(&s).ok())
|
||||
.unwrap_or_else(|| json!("unknown"));
|
||||
let serialized = serde_json::to_value(next).unwrap_or_else(|_| json!("unknown"));
|
||||
let _ = app_handle.emit(
|
||||
"qconnect:status_changed",
|
||||
json!({
|
||||
|
||||
Reference in new issue
Block a user